from sys import stdin
input = stdin.readline

n = int(input())
a = dict()
b = dict()
cnt = 1
cnt2 = 1
cnt3, cnt4 = 0, 0

for _ in range(n):
    x, y = map(int, input().split())

    if y == 0:
        cnt3 += 1
    elif x / y in a.keys():
        a[x / y] += 1
    else:
        a[x / y] = 1

    if x == 0:
        cnt4 += 1
    elif -y / x in b.keys():
        b[-y / x] += 1
    else:
        b[-y / x] = 1

for x in a:
    if x in b.keys():
        cnt *= (2 ** a[x] + 2 ** b[x] - 1)
        cnt2 *= (2 ** a[x] + 2 ** b[x] - 1)
    else:
        cnt *= 2 ** a[x]

cnt *= (2 ** cnt3 + 2 ** cnt4 - 1)
print((int(cnt // (cnt2 ** (1/2))) - 1) % 1000000007)