from math import gcd
import random
n = int(input())
mod = 10**9 + 7
d1 = dict()
a_zero,b_zero = 0,0
ab = 0
# サンプル入力
#n = 2*10**5
#data = [[random.randint(-10**18,10**18),random.randint(-10**18,10**18)] for _ in range(n)]
for i in range(n):
    a,b = map(int, input().split())
    #a,b = data[i]
    if a == 0 and b == 0:
        ab += 1
        continue
    if a == 0:
        a_zero += 1
        continue
    if b == 0:
        b_zero += 1
        continue
    a,b = a//gcd(a,b),b//gcd(a,b)
    if a < 0:
        a *= -1
        b *= -1

    if (a,b) in d1:
        d1[(a,b)] += 1
    else:
        d1[(a,b)] = 1

ans =  1
ans *= pow(2,a_zero,mod)+pow(2,b_zero,mod)-1
ans %= mod
for a,b in d1:
    if b > 0 and (b,-a) in d1:
        ans *= pow(2,d1[(a,b)],mod)+pow(2,d1[(b,-a)],mod)-1
        d1[(a,b)] = 0
        d1[(b,-a)] = 0
    elif b < 0 and (-b,a) in d1:
        ans *= pow(2,d1[(a,b)],mod)+pow(2,d1[(-b,a)],mod)-1
        d1[(a,b)] = 0
        d1[(-b,a)] = 0
    else:
        ans *= pow(2,d1[(a,b)],mod)
        d1[(a,b)] = 0
    ans %= mod
    #print(a,b,d1)
print(ans-1 + ab)