import sys
input = sys.stdin.readline
import collections
MOD = 1000000007
INF = 10 ** 100

n = int(input())
ratio = []
for i in range(n):
    a, b = map(int, input().split())
    if a == 0:
        ratio.append(INF)
    else:
        ratio.append(b/a)

ratio = collections.Counter(ratio)

ans = 1
done = set()
flag = True
for key, value in ratio.items():
    if key == 0:
        key2 = INF
    elif key == INF:
        key2 = 0
    else:
        key2 = -1 / key
    if key2 in done:
        continue

    value2 = ratio[key2]
    if value2 == 0:
        ans *= pow(2, value, MOD)
        flag = False
    else:
        ans *= pow(2, value, MOD) + pow(2, value2, MOD) - 1
        done.add(key)
    ans %= MOD

if flag:
    print(ans)
else:
    print(ans - 1)
