from sys import stdin
from collections import defaultdict
from math import gcd


def main():
    MOD = 1000000007

    # N, *AB = map(int, stdin.buffer.read().split())
    N = int(input())
    AB = (map(int, input().split()) for _ in range(N))

    d = defaultdict(int)
    n_zeros = 0

    for a, b in AB:
        if a == 0 and b == 0:
            n_zeros += 1
            continue

        g = gcd(a, b)
        a, b = a // g, b // g

        if a * b > 0 or b == 0:
            c = abs(a) + abs(b) * 1j
        else:  # a * b < 0 or a == 0
            c = - abs(b) - abs(a) * 1j

        d[c] += 1

    ans = 1
    free = 0
    for c, n in d.items():
        # if -c in d:
        #     if c.real > 0:
        #         m = d[-c]
        #         ans = ans * (pow(2, n, MOD) + pow(2, m, MOD) - 1) % MOD
        # else:
        #     free += n
        if c.real > 0:
            if -c in d:
                m = d[-c]
                ans = ans * (pow(2, n, MOD) + pow(2, m, MOD) - 1) % MOD
            else:
                free += n
        else:
            if -c not in d:
                free += n

    ans = (ans * pow(2, free, MOD) + n_zeros - 1) % MOD
    print(ans)


if __name__ == '__main__':
    main()
