def findY(A,B,x):
    """
    given a line formed by 2 points A and B
    returns the value of y at x on that line
    """
    if B[0] - A[0] == 0:
        return 0
    m = (B[1]-A[1]) / (B[0]-A[0])
    b = A[1] - m*A[0]
    return m*x + b