def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

N = int(input())
d = {}
for i in range(N):
    A, B = map(int, input().split())
    g = gcd(abs(A), abs(B))
    
    if A*B > 0:
        key = (abs(A)//g, abs(B)//g)
        if key not in d:
            d[key] = [0, 0]
        d[key][0] += 1
    else:
        key = (abs(B)//g, abs(A)//g)
        if key not in d:
            d[key] = [0, 0]
        d[key][1] += 1


MOD = 10 ** 9 + 7

ans = 1
for k, v in d.items():
#     print(2 ** v[0] + 2 ** v[1] - 1)
    temp = pow(2, v[0], MOD) + pow(2, v[1], MOD) - 1
    if temp < 0:
        temp += MOD
    ans = ans * temp % MOD
ans = ans - 1
if ans < 0:
    ans += MOD
print(ans)
    