N = int(input())
A = []
B = []
C = {}
m = 1000000007

def mypow(dummy, num):

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

for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
    if a/b in C.keys():
        C[a/b] +=1
    else: C[a/b] = 1
    
used = set()
ans = 1
for c in C.keys():
    if c in used: continue
    if -1/c in C.keys():
        used.add(-1/c)
        
        score = mypow(2, C[c]) + mypow(2, C[-1/c])- 1
        
        ans = (ans * score)%m

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

print(ans-1)




