import math
mod = 10**9+7
n = int(input())
mp = {}
zero = 0
for i in range(n):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        zero += 1
        continue
    g = math.gcd(a, b)
    a /= g
    b /= g
    if b < 0:
        a, b = -a, -b
    if b == 0 and a < 0:
        a, b = 1, 0
    rot90 = a <= 0
    if rot90:
        a, b = b, -a
        if (a, b) in mp:
            mp[(a,b)][0] += 1
        else:
            mp[(a,b)] = [1, 0]
    else:
        if (a, b) in mp:
            mp[(a, b)][1] += 1
        else:
            mp[(a, b)] = [0, 1]
ans = 1
for k in mp:
    s = mp[k][0]
    t = mp[k][1]
    now = 1
    now = (now + (pow(2, s, mod) - 1) % mod) % mod
    now = (now + (pow(2, t, mod) - 1) % mod) % mod
    ans = (ans * now) % mod
ans =  (ans -1) % mod
ans = (ans + zero) % mod 
print(ans)