from collections import Counter
import fractions

P =1000000007
zz = 0
ABs = []
conb = []
uni = 0
pair = 0

N = int(input())
for _ in range(N):
  a,b = map(int, input().split())
  if b == 0:
    ABs.appned('1 0')
  elif b > 0:
    c = fractions.gcd(a,b)
    ABs.append(str(a//c)+' '+str(b//c))
  else:
    c = fractions.gcd(abs(a),abs(b))
    ABs.append(str(-a//c)+' '+str(-b//c))

d = Counter(ABs)

for i in d:
  if i == '0 0':
    zz = d[i]
  elif i[0] == '-':
    a, b = i.split()
    j = b+' '+a[1:]
    if d[j] > 0:
      conb.append([d[i],d[j]])
      pair += d[i]+d[j]
  elif i[0] == '0':
    j = '1 0'
    if d[j] > 0:
      conb.append([d[i],d[j]])
      pair += d[i]+d[j]
    
uni = N - zz - pair

rlt = (2**uni) % P
for p in conb:
  rlt *= (2**p[0] + 2**p[1] - 1) % P

rlt += zz - 1

print(rlt)