import math
M = 10**9+7
def getRev(a,b):
    if -b>0:
        return (-b,a)
    else:
        return (b,-a)

def main():
    n = int(input())
    
    d = {}
    
    for _ in range(n):
        a,b = tuple(map(int,input().split()))
        if a<0:
            a,b = -a,-b
        e1,e2 = 0,0
        if a!=0 and b!=0:
            g = math.gcd(abs(a),abs(b))
            e1,e2 = a//g,b//g
        else:
            g = max(abs(a),abs(b))
            if g!=0:
                e1,e2 = a//g,b//g
        k = e1,e2
        d.setdefault(k,0)
        d[k] += 1

    ans = 1
    for k,v in d.items():
        if k == (0,0):
            pass
        else:
            k_r = getRev(*k)
            if k_r in d:
                if d[k_r]!=-1 and d[k]!=-1:
                    v2 = d[k_r]
                    ans *= (pow(2,v,M)+pow(2,v2,M)-1)
                    ans %= M
                    d[k] = -1
                    d[k_r] = -1
            else:
                ans*=pow(2,v,M)
                ans %= M

    print(ans-1)
        

if __name__ == "__main__":
    main()