from collections import Counter
mod = 1000000007
N = int(input())
AB = Counter()
x = set()
for _ in range(N):
    a, b = map(int, input().split())
    AB[a*b] += 1
    if AB[-a*b] > 0:
        x.add(abs(a*b))

cnt = 0

res = 1
for i in x:
    ares = res
    
    a = 1
    for _ in range(AB[i]):
        a *= 2
        a %= mod
    a -= 1
    if a < 0:
        a += mod
    res += ares*a
    cnt += AB[i]


    a = 1
    for _ in range(AB[-i]):
        a *= 2
        a %= mod
    a -= 1
    if a < 0:
        a += mod
    res += ares*a
    cnt += AB[-i]

a = 1
for _ in range(N-cnt):
    a *= 2
    a %= mod
a -= 1
if a < 0:
    a += mod
res += res*a

print(res-1)