N = int(input())
st = {}
dz = 0
count = 0
for i in range(N):
    a, b = map(int,input().split())
    if a == 0 and b == 0:
        dz += 1
    elif b == 0:
        if 'inf' in st:
            st['inf'] += 1
        else:
            st['inf'] = 1
    else:
        c = a / b
        if c in st:
            st[c] += 1
        else:
            st[c] = 1
ans = 1
if 'inf' in st and 0 in st:
    ans *= (2**(st['inf'])+2**(st[0])-1)
    count += st['inf'] + st[0]
    del st['inf']
    del st[0]
alr = set()
for i, j in st.items():
    if i in alr:
        pass
    else:
        g = -1/i
        if g in st:
            ans *= (2**j+2**(st[g])-1)
            alr |= {g,i}
for i in alr:
    count += st[i]
    del st[i]
ans2 = pow(2,N-count,1000000007)
ans *= ans2
print((ans-1+dz)%1000000007)