from fractions import Fraction

n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
d = {}
r = 0
for i in range(n):
    k = a[i][0]
    l = a[i][1]
    if k == 0 and l == 0:
        r += 1
    elif k == 0:
        if 0 in d:
            d[0][0] = d[0][0] +1
        else:
            d[0] = [1, 0]
    elif l == 0:
        if 0 in d:
            d[0][1] = d[0][1] +1
        else:
            d[0] = [0, 1]
    else:
        if k * l > 0:
            s = Fraction(k, l)
            if s in d:
                d[s][0] = d[s][0] +1
            else:
                d[s] = [1, 0]
        else:
            s = Fraction(-l, k)
            if s in d:
                d[s][1] = d[s][1] +1
            else:
                d[s] = [0, 1]
ans = 1
m = 0
for i in d:
    m += 1
    ans *= 2**d[i][0] + 2**d[i][1] - 1
    #if m != 1:
        #ans -= 1
    #print(ans)
ans -= 1
ans += r
ans = ans%1000000007
#print(d)
print(ans)