N = int(input())
abp = []
abm = []
abz = []
bad_naka = []
for i in range(N):
    q,qq = map(int,input().rstrip().split(" "))
    if q == 0 or qq == 0:
        abz.append(0)
    elif q / qq < 0:
        abm.append(q / qq)
    else:
        abp.append(q / qq)

abm.sort()

abp.sort()

c_p = 0
c_m = 0

bnc = 1
bnc_2 = 1

ans = 0

nokori = N

while c_p != len(abp) -1 or c_m != len(abm) -1:
    if abp[c_p] * abm[c_m] == -1:
        if c_p + 1 <= len(abp) - 1 and abs(abp[c_p + 1]) == abs(abp[c_p]):
            c_p += 1
            bnc += 1
        elif c_m + 1 <= len(abm) -1 and abs(abm[c_m + 1]) == abs(abm[c_m]):
            c_m += 1
            bnc_2 += 1
        else:
            bad_naka.append([bnc,bnc_2])
            if c_m >= len(abm) - 1:
                c_p += 1
            else:
                c_m += 1
            bnc = 1
            bnc_2 = 1

    elif abs(abp[c_p]) * abs(abm[c_m]) < 1 or c_m >= len(abm) - 1:
        c_p += 1
    else:
        c_m += 1

ans += len(abz)
nokori -= len(abz)
for i in range(len(bad_naka)):
    by = (bad_naka[i][1] * (bad_naka[i][1] + 1)) / 2 + (bad_naka[i][0] * (bad_naka[i][0] + 1)) / 2
    nokori -= bad_naka[i][1] + bad_naka[i][0]
    ans *= by + 1
    ans += by
    ans %= 10 ** 10 + 7
for i in range(nokori):
    ans *= 2
    ans += 1
    ans %= 10 ** 10 + 7
    
print(ans)
