from math import gcd
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
mod = 1000000007

#%%

kai = [1]*(n+1)
gyaku = [1]*(n+1)

for i in range(2, n+1):
    kai[i] = kai[i-1]*i % mod
    gyaku[i] = gyaku[i-1]*pow(i, mod-2, mod) %mod

azero = 0
bzero = 0

dict_patterns = {}
all_effective = 0
answer = 0
for i in range(n):
    a, b = ab[i]
    if a == 0 and b == 0:
        continue
    elif a == 0:
        azero += 1
        continue
    elif b == 0:
        bzero += 1
        continue
    
    common = gcd(a,b)
    a, b = int(a/common), int(b/common)
    minus = 0
    
    to_str = str(a)+","+str(b)
    
    if to_str not in dict_patterns:
        dict_patterns[to_str] = 1
    else:
        dict_patterns[to_str] += 1

keys = list(dict_patterns.keys())
patterns = []
for i in range(len(keys)):
    pattern_A = dict_patterns[keys[i]]
    dict_patterns[keys[i]] = 0
    pattern_B = 0
    a, b = map(int, keys[i].split(","))
    if str(-a)+","+str(-b) in keys:
        pattern_A += dict_patterns[str(-a)+","+str(-b)]
        dict_patterns[str(-a)+","+str(-b)] = 0
    if str(-b)+","+str(a) in keys:
        pattern_B += dict_patterns[str(-b)+","+str(a)]
        dict_patterns[str(-b)+","+str(a)] = 0
    if str(b)+","+str(-a) in keys:
        pattern_B += dict_patterns[str(b)+","+str(-a)]
        dict_patterns[str(b)+","+str(-a)] = 0
    if pattern_A != 0 or pattern_B != 0:
        patterns.append(max(2**pattern_A-1,0) + max(2**pattern_B-1,0) + 1)

patterns.append(max(2**azero-1,0) + max(2**bzero-1,0) + 1)
        
answer = 1
for i in range(len(patterns)):
    answer = answer*patterns[i]%mod

print(answer-1)