N = int(input())
AB = [list(map(int,input().split())) for _ in range (N)]
MOD = 10**9+7

from collections import defaultdict
dnums = defaultdict(int)
dnums2 = defaultdict(int)
num_zero = 0
num_az = 0
num_bz = 0
keys = set()
for a,b in AB:
    if a!=0 and b!=0:
        dnums[b/a] += 1
        keys.add(b/a)
        dnums2[-a/b] += 1
    elif a==0 and b==0:
        num_zero += 1
    elif a == 0 and b!=0:
        num_az += 1
    elif a != 0 and b==0:
        num_bz += 1

mydict = dict()
for key in list(keys):
    mydict[key] = False

ans = 1
for key in list(keys):
    if mydict[key]:
        continue
    if -1/key in keys:
        mydict[-1/key] = True
        mydict[key] = True

    if dnums2[key] != 0:
        ans *= pow(2, dnums[key], MOD) + pow(2, dnums2[key], MOD) - 1
    else:
        ans *= 2

ans *= pow(2, num_az, MOD) + pow(2, num_bz, MOD) - 1
ans += num_zero
ans -= 1
print(ans)


