def main():
    import sys
    
    input = sys.stdin.readline
    n = int(input())
    mod = 10**9+7
    d = {}
    l1 = []
    l2 = []
    zero = [0]*3
    for i in range(n):
        a,b = map(int,input().split())
        if a == 0 and b == 0:
            zero[0] += 1
        elif a == 0:
            zero[1] += 1
        elif b == 0:
            zero[2] += 1
        else:
            s1 = -b/a
            s2 = a/b
            if s2 in d:
                d[s2] += 1
            else:
                l1.append(s2)
                l2.append(-1)
                d[s2] = 1
                if s1 in d:
                    ind = l1.index(s1)
                    l2[-1] = ind
                    l2[ind] = len(l1)-1

    done = set()
    ans = 1
    for i in range(len(l2)):
        if l2[i] < 0:
            ans *= 2
            ans %= mod
        else:
            if l2[i] in done:
                continue
            c1 = d[l1[i]]
            c2 = d[l1[l2[i]]]
            count = (pow(2,c1,mod)+pow(2,c2,mod)-1)%mod
            ans *= count
            ans %= mod
            done.add(i)
            done.add(l2[i])
    c = 0
    if zero[0] > 0:
        c = zero[0]+1
    if zero[1] *zero[2] > 0:
        count = (pow(2,zero[1],mod)+pow(2,zero[2],mod)-1)%mod
        ans *= count
        ans %= mod
    elif zero[1] > 0:
        ans *= pow(2,zero[1],mod)
        ans %= mod
    elif zero[2] > 0:
        ans *= pow(2,zero[2],mod)
        ans %= mod
    print(ans+-1)
            
if __name__ =="__main__":
    main()
