import math

# Combination
MOD = 10**9+7
MAX = 2*10**5
fac = [1,1] + [0]*MAX
finv = [1,1] + [0]*MAX
inv = [0,1] + [0]*MAX
for i in range(2,MAX+2):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = -inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def comb(n,r):
    if n < r: return 0
    if n < 0 or r < 0: return 0
    return fac[n] * (finv[r] * finv[n-r] % MOD) % MOD

from collections import defaultdict

N = int(input())
dic = defaultdict(int)
gp = []
for i in range(N):
    a,b = map(int, input().split())
    g = math.gcd(a, b)
    a //= g
    b //= g
    dic[str(a)+":"+str(b)] += 1
    gp.append((a, b))
cnt = 0
print(dic)
for a,b in gp:
    if (a >= 0 and b >= 0) or (a <= 0 and b <= 0):
        cnt += dic[str(b)+":"+str(-a)]
        cnt += dic[str(-b)+":"+str(a)]
    else:
        cnt += dic[str(b)+":"+str(a)]
        cnt += dic[str(-b)+":"+str(-a)]
#print(cnt)
cnt //= 2
ans = N
for i in range(2,N+1):
    c = comb(N, i) - cnt*comb(N-2, i-2)
    c = max(0, c)
    #print(i, comb(N, i), cnt*comb(N-2, i-2))
    if c < 0:
        c += MOD
    ans += c
    ans %= MOD
print(ans)
