import math
import collections

n = int(input())
mod = 10 * 6 + 7
c = []
d = []

tan = []
atan = []

for _ in range(n):
    a, b = map(int, input().split())
    if b == 0: tan.append(float('inf'))
    else: tan.append(a / b)
    if a == 0: atan.append(float('inf'))
    else: atan.append(- b / a)

tan = collections.Counter(tan)
atan = collections.Counter(atan)

for key, value in tan.items():
    if abs(key) > 1: continue
    if atan[key] > 0:
        c.append(value)
        d.append(value)

ans = pow(2, n - sum(c) - sum(d), mod)
for i, j in zip(c, d):
    ans = (ans * (pow(2, i, mod) + pow(2, j, mod) - 1)) % mod
ans -= 1

print(ans)