from fractions import Fraction

N = int(input())

vec = [list(map(int,input().split())) for i in range(N)]

from collections import defaultdict

arg = defaultdict(int)
zero = 0
for v in vec:
    if v[0] == 0 and v[1] == 0:
        zero += 1
    elif v[1]==0:
        arg[float("inf")] += 1
        arg[0] += 1
    else:
        arg[Fraction(v[0],v[1])] += 1
        arg[Fraction(-v[1],v[0])] += 0

pair = []

ll = lambda : False

checked_list = defaultdict(ll)
for key in arg:
    if not checked_list[key]:
        if key==0:
            pair.append([arg[0],arg[float("inf")]])
            checked_list[float("inf")] = True
        elif key==float("inf"):
            pair.append([arg[0],arg[float("inf")]])
            checked_list[0] = True

        else:
            #print(key)
            pair.append([arg[key],arg[-1/key]])
            #print(pair)
            checked_list[-1/key] = True

mod = 1000000007

ans = 1

for p1,p2 in pair:
    ans *= pow(2,p1,mod) + pow(2,p2,mod) - 1
    ans %= mod

ans += zero
ans %= mod

print(ans-1)