def resolve():
    from math import gcd
    n=int(input())
    INF=10**19
    MOD=10**9+7
    abc={}
    for i in range(n):
        a,b=map(int,input().split())
        if a==0 and b==0:
            c='0'
        elif a==0:
            c='0/1'
        elif b==0:
            c='-1/0'
        else:
            g=gcd(abs(a),abs(b))
            if a*b<0:
                c='-'+str(int(abs(a)/g))+'/'+str(int(abs(b)/g))
            else:
                c=str(int(abs(a)/g))+'/'+str(int(abs(b)/g))
        if c in abc.keys():
            abc[c]+=1
        else:
            abc[c]=1
    ans,cnt,zero=1,0,0
    for i,j in abc.items():
        if i=='0':
            zero+=j
            abc[i]=0
            continue
        if j==0:
            continue
        bi=i
        if i[0]=='-':
            i=i[::-1][:-1]
        else:
            i='-'+i[::-1]
        if i in abc.keys():
            k=abc[i]
            abc[bi],abc[i]=0,0
            ans*=pow(2,j,MOD)+pow(2,k,MOD)-1
            ans%=MOD
        else:
            cnt+=1
    ans*=pow(2,sum(abc.values()),MOD)
    ans%=MOD
    if ans>0:
        ans-=1
    ans+=zero
    print(ans%MOD)

if __name__ == '__main__':
    resolve()