import sys
input = sys.stdin.readline
sys.setrecursionlimit(200000)
import bisect


def binom_preprocess(n, MOD=1000000007):
    f = [0 for i in range(n+1)]  # n!
    invf = [0 for i in range(n+1)]  # (n!)^-1
    f[0] = 1
    f[1] = 1
    invf[0] = 1
    invf[1] = 1
    for i in range(2, n+1):
        f[i] = f[i-1] * i % MOD
        invf[i] = pow(f[i], MOD-2, MOD)
    return f, invf


def binom(n, k, f, invf, MOD=1000000007):
    if n < k or n < 0 or k < 0:
        return 0
    else:
        return (f[n] * invf[k] % MOD) * invf[n-k] % MOD


def read():
    N = int(input().strip())
    AB = []
    for i in range(N):
        a, b = map(int, input().strip().split())
        AB.append((a, b))
    return N, AB


def solve(N, AB, MOD=1000000007):
    adivb = [a / b if b != 0 else 0 for a, b in AB]
    bdiva = [-b / a if a != 0 else 0 for a, b in AB]
    adivb.sort()
    bdiva.sort()
    count = 0
    eps = 10 ** -19
    for x in adivb:
        l = bisect.bisect_left(bdiva, x-eps)
        r = bisect.bisect_right(bdiva, x+eps)
        count += (r - l)
    count //= 2

    f, invf = binom_preprocess(N)
    ans = 0
    # k = 1
    ans += binom(N, 1, f, invf)
    ans %= MOD
    # k >= 2
    for k in range(2, N):
        ans += binom(N-count, k, f, invf)
        ans %= MOD
        ans += binom(N-count, k-1, f, invf) * binom(count, 1, f, invf)
        ans %= MOD
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))
