import math
N = int(input())
A = 0
B = 0
Z = 0
C = {}
m = 1000000007

def mypow(dummy, num):
    ans = 1
    for i in range(num):
        ans = (ans*2)%1000000007
    return ans

def rNum(a, b):
    g = math.gcd(a, b)
    if a >0 and b <0:
        return (-1*(a//g), -1*(b//g))
    else:
        return (a//g, b//g)

def inv(rnum):
    a,b = rnum
    if a <0 and b >0:
        return (-1*b, -1*a)
    else:
        return (b, a)
        

for i in range(N):
    a, b = map(int, input().split())
    
    if a == 0 and b==0:
        Z += 1
        continue
    elif a==0:
        A += 1
        continue
    elif b==0:
        B +=1
        continue
    
    r = rNum(a, b)
    if r in C.keys():
        C[r] +=1
    else: C[r] = 1


used = set()
ans = 1
ans *= (mypow(2, A) + mypow(2, B) -1)%m


for c in C.keys():
    if c in used: continue
    a, b = c
    a *= -1
    r = rNum(b, a)
    if r in C.keys():
        # print(inv(c), c)
        if c == r: continue
        
        used.add(r)
        score = mypow(2, C[c]) + mypow(2, C[r])- 1
        ans = (ans * score)%m

    else:
        ans = (ans*mypow(2, C[c]))%m

ans += Z

print(ans-1)




