# -*- coding: utf-8 -*-

from math import gcd



N = int(eval(input()))



dict_F = {}

count_0 = 0



def insert(A,B,s): # A>=0, B>0, s=0or1

  if (A,B) not in list(dict_F.keys()):

    dict_F[(A,B)] = [0,0]

  dict_F[(A,B)][s] += 1



def make_power2(N):

  result = 1

  list_result = [1]

  for _ in range(N):

    result = (2*result)%mod

    list_result.append(result)

  return list_result



for i in range(N):

  A,B = list(map(int, input().split()))

  if A==0 and B==0:

    count_0 += 1

    continue

  g = gcd(A,B)

  A //= g

  B //= g

  if A>=0 and B>0:

    insert(A,B,0)

  elif A>0 and B<=0:

    insert(-B,A,1)

  elif A<=0 and B<0:

    insert(-A,-B,0)

  elif A<0 and B>=0:

    insert(B,-A,1)



mod = 1000000007

power2 = make_power2(N)

answer = 1



for A,B in list(dict_F.values()):

  answer = (answer*(power2[A]+power2[B]-1))%mod

answer = (answer+count_0-1)%mod



print(answer)
# -*- coding: utf-8 -*-

import sys

from math import gcd



N, *AB = list(map(int, sys.stdin.read().split()))



dict_F = {}

count_0 = 0



def insert(A,B,s): # A>=0, B>0, s=0or1

  if (A,B) not in list(dict_F.keys()):

    dict_F[(A,B)] = [0,0]

  dict_F[(A,B)][s] += 1



def make_power2(N):

  result = 1

  list_result = [1]

  for _ in range(N):

    result = (2*result)%mod

    list_result.append(result)

  return list_result



for i in range(N):

  A,B = AB[2*i], AB[2*i+1]

  if A==0 and B==0:

    count_0 += 1

    continue

  g = gcd(A,B)

  A //= g

  B //= g

  if A>=0 and B>0:

    insert(A,B,0)

  elif A>0 and B<=0:

    insert(-B,A,1)

  elif A<=0 and B<0:

    insert(-A,-B,0)

  elif A<0 and B>=0:

    insert(B,-A,1)



mod = 1000000007

power2 = make_power2(N)

answer = 1



for A,B in list(dict_F.values()):

  answer = (answer*(power2[A]+power2[B]-1))%mod

answer = (answer+count_0-1)%mod



print(answer)

# -*- coding: utf-8 -*-
from math import gcd

N = int(eval(input()))
dict_F = {}
count_0 = 0


def insert(A, B, s):  # A>=0, B>0, s=0or1
    if (A, B) not in list(dict_F.keys()):
        dict_F[(A, B)] = [0, 0]
    dict_F[(A, B)][s] += 1


def make_power2(N):
    result = 1
    list_result = [1]
    for _ in range(N):
        result = (2 * result) % mod
        list_result.append(result)
    return list_result


for i in range(N):
    A, B = list(map(int, input().split()))
    if A == 0 and B == 0:
        count_0 += 1
        continue
    g = gcd(A, B)
    A //= g
    B //= g
    if A >= 0 and B > 0:
        insert(A, B, 0)
    elif A > 0 and B <= 0:
        insert(-B, A, 1)
    elif A <= 0 and B < 0:
        insert(-A, -B, 0)
    elif A < 0 and B >= 0:
        insert(B, -A, 1)
mod = 1000000007
power2 = make_power2(N)
answer = 1
for A, B in list(dict_F.values()):
    answer = (answer * (power2[A] + power2[B] - 1)) % mod
answer = (answer + count_0 - 1) % mod
print(answer)

# -*- coding: utf-8 -*-
import sys
from math import gcd

N, *AB = list(map(int, sys.stdin.read().split()))
dict_F = {}
count_0 = 0


def insert(A, B, s):  # A>=0, B>0, s=0or1
    if (A, B) not in list(dict_F.keys()):
        dict_F[(A, B)] = [0, 0]
    dict_F[(A, B)][s] += 1


def make_power2(N):
    result = 1
    list_result = [1]
    for _ in range(N):
        result = (2 * result) % mod
        list_result.append(result)
    return list_result


for i in range(N):
    A, B = AB[2 * i], AB[2 * i + 1]
    if A == 0 and B == 0:
        count_0 += 1
        continue
    g = gcd(A, B)
    A //= g
    B //= g
    if A >= 0 and B > 0:
        insert(A, B, 0)
    elif A > 0 and B <= 0:
        insert(-B, A, 1)
    elif A <= 0 and B < 0:
        insert(-A, -B, 0)
    elif A < 0 and B >= 0:
        insert(B, -A, 1)
mod = 1000000007
power2 = make_power2(N)
answer = 1
for A, B in list(dict_F.values()):
    answer = (answer * (power2[A] + power2[B] - 1)) % mod
answer = (answer + count_0 - 1) % mod
print(answer)

+import sys -N = int(eval(input())) +N, *AB = list(map(int, sys.stdin.read().split())) -    A, B = list(map(int, input().split())) +    A, B = AB[2 * i], AB[2 * i + 1]