import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**19
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N = NI()
    AB = [LI() for _ in range(N)]
    d = {}

    ans = 0
    m = 0
    for i in range(N):
        a,b = AB[i]
        if a == 0:
            f = INF
        else:
            f = -b/a
        c = d.get(f,0)

        ans = (ans * 2) % MOD
        ans -= (pow(2,i,MOD) - pow(2,(i-c,MOD))) % MOD
        if b == 0:
            f = INF
        else:
            f = a/b
        if f in d:
            d[f] += 1
        else:
            d[f] = 1

    print(ans)

if __name__ == '__main__':
    main()