from collections import defaultdict
from math import gcd
n = int(input())
ab = [tuple(map(int,input().split())) for i in range(n)]
mod = 10 ** 9 + 7
cnt = defaultdict(lambda :0)

for i in range(n):
    a, b = ab[i]
    if (a, b) == (0, 0):
        cnt[(0, 0)] += 1
        continue

    elif b == 0:
        temp = (1, 0)
        cnt[temp] += 1
        ab[i] = temp
        continue

    GCD = gcd(a, b)
    temp = (a // GCD, b // GCD) if b > 0 else (- a // GCD, - b // GCD)
    cnt[temp] += 1
    ab[i] = temp

check = defaultdict(lambda :0)
for key in ab:
    a, b = key
    if not check[key]:check[key] += cnt[(-b, a)]

num = n - cnt[(0, 0)]
ans = 0
for key in ab:
    if key == (0, 0):
        ans += 1
        continue
        
    a, b = key
    k = num - check[key] if check[key] > 0 else num
    if k > 0:
        ans = (ans + (pow(2, k) - pow(2, k - 1)) % mod) % mod
    check[(-b, a)] -= 1
    num -= 1
    #print(key, ans, num, k)

print(ans)