import sys
from collections import defaultdict

sys.setrecursionlimit(10 ** 6)
INF = float("inf")
MOD = 10 ** 9 + 7


def input():
    return sys.stdin.readline().strip()


def modpow(a, n, mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res


def main():
    N = int(input())
    A = []
    B = []
    kinds = defaultdict(int)

    for _ in range(N):
        a, b = map(int, input().split())

        if b == 0:
            kinds[INF] += 1
        else:
            kinds[a / b] += 1

    # i番目のグループを使うときとそうでない時の総数
    data = list(kinds.items())
    n_groups = len(data)
    ans = 1
    used = set()
    cnt = 0
    for i in range(n_groups):
        k, v = data[i - 1]
        if k == INF:
            rev = 0
        elif k == 0:
            rev = INF
        else:
            rev = -1 / k

        if k in used or rev in used:
            continue

        ng = kinds[rev]

        if ng == 0:
            used.add(rev)
            used.add(k)
            cnt += 1
            continue

        ans *= modpow(2, v, MOD) - 1 + modpow(2, ng, MOD) - 1 + 1
        ans %= MOD
        used.add(rev)
        used.add(k)

    ans *= modpow(2, cnt, MOD)
    ans %= MOD
    ans -= 1
    print(ans)


if __name__ == "__main__":
    main()
