import math
from collections import Counter

mod=1000000007

n=int(input())
katamuki_list=[]
for i in range(n):
    a, b=map(int, input().split())
    if a==0 and b==0:
        tmp=(0, 0)
    elif a==0:
        tmp=(0, 1)
    elif b==0:
        tmp=(1, 0)
    else:
        gcd=math.gcd(a, b)
        a=a//gcd
        b=b//gcd
    katamuki_list.append((a, b))

katamuki_counter=Counter(katamuki_list)
ans=1
for katamuki_key in list(katamuki_counter.keys()):
    # print(katamuki_key)
    katamuki_value=katamuki_counter[katamuki_key]
    if (0, 0)==katamuki_key:
        pass
    elif (0, 1)==katamuki_key or (1, 0)==katamuki_key:
        pass
    else:
        if katamuki_value!=0:
            reverse_0=(-katamuki_key[1], katamuki_key[0])
            reverse_1=(katamuki_key[1], -katamuki_key[0])
            reverse_count=katamuki_counter[reverse_0]+katamuki_counter[reverse_1]
            # print(reverse_count)
            ans=ans*(pow(2, katamuki_value, mod)-1+pow(2, reverse_count, mod)-1+1)%mod
            # print(ans)
            katamuki_counter[reverse_0]=0
            katamuki_counter[reverse_1]=0
ans=(ans*(pow(2, katamuki_counter[(1, 0)], mod)-1+pow(2, katamuki_counter[(0, 1)], mod)-1+1))%mod
ans=ans-1 #全て選ばないという場合を引く
ans=(ans+katamuki_counter[(0, 0)])%mod

print(ans)
