from collections import defaultdict
MOD = 10**9+7
N = int(input())
bul = defaultdict(int)
bul2 = defaultdict(int)
for _ in range(N):
    a,b = map(int,input().split())
    bul[a/b] += 1
    bul2[-(b/a)] += 1

ALL = pow(2,N,MOD)-1

for k in bul.keys():
    if k <= 0:
        ALL -= bul2[k] * bul[k] * (N-1)
        ALL %= MOD

print(ALL)


