def main():
    import sys
    input = sys.stdin.buffer.readline
    n = int(input())
    mod = 10**9 + 7
    C_p,C_n = [],[]
    from fractions import Fraction as f
    for i in range(n):
        a,b = map(int, input().split())
        if b == 0:
            C_n.append(0)
        elif a/b < 0:
            C_n.append(f(a/b))
        else:
            C_p.append(f(a/b))
    import numpy as np
    from collections import Counter as cc
    C_p,C_n = cc(C_p),cc(C_n)
    count= 0
    re = 1
    for c in C_p:
        if c == 0:
            re *= (2**C_n[c] + 2**C_p[c] -1)%mod
            count += C_p[c]+C_n[c]
            continue

        if (cinv:=f(-1/c)) in C_n:
            count += C_n[cinv] + C_p[c]
            re *= (2**C_n[cinv] + 2**C_p[c] -1)%mod
    ans = pow(2,n-count,mod)*re%mod -1
    print(ans)


if __name__ == '__main__':
    main()