N = int(input()) 
Group = {}
zero = 0
import math
for _ in range(N): 
    a,b = list(map(int,input().split())) 
    if a*a + b*b == 0:
        zero += 1
        continue

    if b < 0: 
        a = -1*a 
        b = -1*b 
    elif (b == 0)*(a < 0):
        a = -1*a 
        
    if (a <= 0)*(b > 0): 
        ratio = -a/b
        if ratio in Group:
            Group[ratio][0] += 1
        else:
            Group[ratio] = [1,0]
    else: 
        ratio = b/a
        if ratio in Group:
            Group[ratio][1] += 1
        else:
            Group[ratio] = [0,1]
            
ans = 1
for i in Group:
    n,p = Group[i]
    now = 1
    tmp = 1
    for j in range(n):
        tmp *= 2
        if tmp > 1000000007:
            tmp = tmp%1000000007
    
    now += tmp - 1
    tmp = 1
    for j in range(p):
        tmp *= 2
        if tmp > 1000000007:
            tmp = tmp%1000000007
    now += tmp - 1
    ans *= now
    if ans > 1000000007:
        ans = ans % 1000000007
ans += zero -1
print(int(ans))