n = int(input())
A_B_dict = {}
RF_zero = 0
R_zero = 0
F_zero = 0
for i in range(n):
    a, b = map(int,input().split())
    if a == 0:
        if b == 0:
            RF_zero += 1
        else:
            RF_zero += 0
    if b == 0:
        F_zero += 1
    else:
        temp = a/b
        if temp in A_B_dict:
            A_B_dict[temp] += 1
        else:
            A_B_dict[temp] = 1
net_dict = {}
for i in A_B_dict:
    temp = -1/i
    if temp in A_B_dict:
        if i not in net_dict:
            net_dict[temp] = pow(2, A_B_dict[i], 1000000007) + pow(2, A_B_dict[temp], 1000000007) - 1
    else:
        net_dict[temp] = pow(2,A_B_dict[i], 1000000007)
ans = pow(2, R_zero, 1000000007) + pow(2, F_zero, 1000000007) - 1
for k in net_dict.values():
    ans = (ans*k)
print((ans-1)%1000000007)