N = int(input())
# AB_list = [list(map(int, input().split())) for _ in range(N)]

M = 1000000007

# AB = [A / B for A, B in AB_list]
# BA = [-B / A for A, B in AB_list]
groups = dict()
group_keys = set()
ans_L = []

# print(AB_list)
# print(AB)
# print(BA)

def prepare(n, MOD):
 
    # 1! - n! の計算
    f = 2
    factorials = [1]  # 0!の分
    for m in range(1, n + 1):
        f *= m
        f %= MOD
        factorials.append(f)
    # n!^-1 の計算
    inv = pow(f, MOD - 2, MOD)
    # n!^-1 - 1!^-1 の計算
    invs = [1] * (n + 1)
    invs[n] = inv
    for m in range(n, 1, -1):
        inv *= m
        inv %= MOD
        invs[m - 1] = inv
     
    return factorials, invs

fac, invs = prepare(N, M)

def comb(n, r):
    return fac[n] * invs[r] * invs[n-r] % M

def all_comb(n):
    ret = 1
    for i in range(1, n+1):
        ret += comb(n, i)
    return ret


for _ in range(N):
    a,b = map(int, input().split())
    AB = a / b
    BA = -b / a
    if BA in group_keys:
        groups[BA][1] += 1
    elif AB in group_keys:
        groups[AB][0] += 1
    else:
        groups[AB] = [1, 0]
        group_keys.add(AB)

for i, j in groups.values():
    comb_i = all_comb(i)
    if j == 0:
        ans_L.append(comb_i)
    else:
        comb_j = all_comb(j)
        ans_L.append((comb_i + comb_j - 1) % M)

ans = 1
for i in ans_L:
    ans *= i % M
print(ans % M - 1)
