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