def sign_of_weight(x, weight):
    """
    Determines the sign of a weight, based on the value of the first digit of the gene.

    :param x: int, range [0, 9]
                First digit of the gene.
    :param weight: int
                Weight determined from the gene.

    :return: int
            Signed weight.
    """
    if x >= 5:
        return weight
    else:
        return -weight