n=int(input())
mod = 1000000007
gp = []
gm = []
ga0  =0
gb0 = 0
ans = 1
cnt = 0
for _ in range(n):
    a,b= map(int,input().split())
    #a,b = 1,1
    if a == 0 and b == 0:
        cnt += 1
    elif  a == 0:
        ga0 += 1
    elif b == 0:
        gb0 += 1
    elif b/a > 0:
        gp.append(b/a)
    else:
        gm.append(-a/b)
gp.sort()
gm.sort()

lp,lm=0,0
cntall = 0
while lp < len(gp) and lm < len(gm):
    cal = gp[lp] - gm[lm]
    if cal == 0:
        cntp,cntm = 1,1
        while lp +1 < len(gp) and  gp[lp] == gp[lp+1]:
            cntp += 1
            lp+=1
        while lm +1 < len(gm) and  gm[lm] == gm[lm+1]:
            cntm += 1
            lm+=1
        ans *= (pow(2,cntp,mod)+pow(2,cntm,mod))%mod-1
        ans %= mod
        lp+=1
        lm+=1
        cntall += cntp+cntm
    elif cal < 0:
        lp += 1
    else:
        lm += 1

ans *= (pow(2,ga0,mod)+pow(2,gb0,mod))%mod-1
ans %= mod
n -= ga0+gb0+cntall+cnt
ans *= pow(2,n,mod)
ans %= mod
ans += cnt - 1
ans %= mod
print(ans)
