import collections

n=int(eval(input()))

A=[]

AA=[]

B=[]

C=[]

X=[]

mod=10**9+7

p=137053438808121949

for i in range(n):

  a,b=list(map(int,input().split()))

  if a<0:

    a=a*-1

    b=b*-1

  if a*b>0:

    A.append(b*pow(a,p-2,p)%p)

  elif a*b<0:

    AA.append(a*pow((-b),p-2,p)%p)

  else:

    if a==0 and b==0:

      X.append(i)

    elif a==0:

      B.append(i)

    else:

      C.append(i)

D=collections.Counter(A)

DD=collections.Counter(AA)

E=set(list(D)+list(DD))

a=1

for i in E:

  a=(a*(2**D[i]+2**DD[i]-1))%mod

a=(a*(2**len(B)+2**len(C)-1)-1)%mod

print(((a+len(X))%mod))
from math import gcd

from collections import defaultdict

n=int(eval(input()))

A=defaultdict(int)

AA=defaultdict(int)

B=[]

C=[]

X=[]

mod=10**9+7

for i in range(n):

  a,b=list(map(int,input().split()))

  if a<0:

    a=a*-1

    b=b*-1

  if a*b>0:

    l=a*b//gcd(a,b)

    A[str(l//b)+":"+str(l//a)]+=1

  elif a*b<0:

    l=a*(-b)//gcd(a,-b)

    AA[str(l//a)+":"+str(l//(-b))]+=1

  else:

    if a==0 and b==0:

      X.append(i)

    elif a==0:

      B.append(i)

    else:

      C.append(i)

E=set(list(A.keys())+list(AA.keys()))

a=1

for i in E:

  a=(a*(2**A[i]+2**AA[i]-1))%mod

a=(a*(2**len(B)+2**len(C)-1)-1)%mod

print(((a+len(X))%mod))
import collections

n = int(eval(input()))
A = []
AA = []
B = []
C = []
X = []
mod = 10**9 + 7
p = 137053438808121949
for i in range(n):
    a, b = list(map(int, input().split()))
    if a < 0:
        a = a * -1
        b = b * -1
    if a * b > 0:
        A.append(b * pow(a, p - 2, p) % p)
    elif a * b < 0:
        AA.append(a * pow((-b), p - 2, p) % p)
    else:
        if a == 0 and b == 0:
            X.append(i)
        elif a == 0:
            B.append(i)
        else:
            C.append(i)
D = collections.Counter(A)
DD = collections.Counter(AA)
E = set(list(D) + list(DD))
a = 1
for i in E:
    a = (a * (2 ** D[i] + 2 ** DD[i] - 1)) % mod
a = (a * (2 ** len(B) + 2 ** len(C) - 1) - 1) % mod
print(((a + len(X)) % mod))

from math import gcd
from collections import defaultdict

n = int(eval(input()))
A = defaultdict(int)
AA = defaultdict(int)
B = []
C = []
X = []
mod = 10**9 + 7
for i in range(n):
    a, b = list(map(int, input().split()))
    if a < 0:
        a = a * -1
        b = b * -1
    if a * b > 0:
        l = a * b // gcd(a, b)
        A[str(l // b) + ":" + str(l // a)] += 1
    elif a * b < 0:
        l = a * (-b) // gcd(a, -b)
        AA[str(l // a) + ":" + str(l // (-b))] += 1
    else:
        if a == 0 and b == 0:
            X.append(i)
        elif a == 0:
            B.append(i)
        else:
            C.append(i)
E = set(list(A.keys()) + list(AA.keys()))
a = 1
for i in E:
    a = (a * (2 ** A[i] + 2 ** AA[i] - 1)) % mod
a = (a * (2 ** len(B) + 2 ** len(C) - 1) - 1) % mod
print(((a + len(X)) % mod))

-import collections +from math import gcd +from collections import defaultdict -A = [] -AA = [] +A = defaultdict(int) +AA = defaultdict(int) -p = 137053438808121949 -        A.append(b * pow(a, p - 2, p) % p) +        l = a * b // gcd(a, b) +        A[str(l // b) + ":" + str(l // a)] += 1 -        AA.append(a * pow((-b), p - 2, p) % p) +        l = a * (-b) // gcd(a, -b) +        AA[str(l // a) + ":" + str(l // (-b))] += 1 -D = collections.Counter(A) -DD = collections.Counter(AA) -E = set(list(D) + list(DD)) +E = set(list(A.keys()) + list(AA.keys())) -    a = (a * (2 ** D[i] + 2 ** DD[i] - 1)) % mod +    a = (a * (2 ** A[i] + 2 ** AA[i] - 1)) % mod