def gcd(a,b):
    if b>a:
        a,b = b,a
    
    if b==0:
        return a
    else:
        return gcd(b,a%b)



N = int(input())

dic = {}

cnt = 0

for i in range(N):
    A,B = map(int,input().split())

    mm = gcd(abs(A),abs(B))
    A = A//mm
    B = B//mm

    A1 = min(abs(A),abs(B))
    B1 = max(abs(A),abs(B))

    mm2 = abs(A1)*10**19+abs(B1)
    mm2 *= A*B//abs(A1*B1)
    if mm2 in dic:
        dic[mm2] += 1
    else:
        dic[mm2] = 1

    if mm2*(-1) in dic:
        cnt += 1
    A,B = B,A
    mm2 = abs(A)*10**19+abs(B)
    mm2 *= A*B//abs(A*B)
    if mm2*(-1) in dic:
        cnt += 1
# print(dic)
mm = N
mod = 1000000007
ans = 1
for i in (dic):
    if (-1)*i in dic:
        mm -= dic[i]
        mm -= dic[(-1)*i]

        mm2 = pow(2,dic[i])%mod + pow(2,dic[(-1)*i])%mod
        ans *= mm2
        ans %mod

ans *= pow(2,mm)%mod
ans -= 1


print(ans)


    

