MAX_A = 10**18+1
DELIM = 1000000007

def kaijo(N):
    if(N==0):
        return 1
    if(N%2==1):
        return (2 * ((kaijo(2, N//2) ** 2)%DELIM)) % DELIM
    else:
        return ((kaijo(2, N//2) % DELIM) ** 2) % DELIM

def main():
    N = int(input())
    AB = [[0] * 2 for i in range(N)]
    X = [0] * N
    no_count_comb = 0
    A_Zeros = []
    B_Zeros = []
    X_Dict = dict()
    for i in range(N):
        A, B = map(int, input().split()))
        if(A == 0):
            A_Zeros.append(i)
            no_count += len(B_Zeros)
        if(B == 0):
            B_Zeros.append(i)
            no_count += len(A_Zeros)
            X[i] = MAX_A

        else:
            X = A / B
            if(X in X_Dict):
                X_Dict[X] += 1
            else:
                X_Dict[X] = 1

            if(1 / X in X_Dict):
                no_count_comb += X_Dict[1/X]
        

    total = kaijo(N) - 1
    no_count = kaijo(N-2)
    print((total - no_count_comb * no_count_comb)%DELIM)

main()