def power_func(a, b, p=1000000007):
    if b == 0:
        return 1
    if b % 2 == 0:
        d = power_func(a, b // 2, p)
        return d * d % p
    if b % 2 == 1:
        return (a * power_func(a, b - 1, p)) % p
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] = power_func(2, A_B_dict[i]) + power_func(2, A_B_dict[temp]) - 1
        else:
            pass
    else:
        net_dict[temp] = power_func(2,A_B_dict[i])
ans = 1
for k in net_dict.values():
    ans = (ans*k)
print((ans-1)%1000000007)