mod = 10**9+7
N = int(input())
iwpos = []
iwneg = []
for i in range(N):
    a, b = map(int,input().split())
    if a*b > 0:
        iwpos.append((a,b))
    else:
        iwneg.append((a,b))

cnt = 0
for ap, bp in iwpos:
    for an, bn in iwneg:
        if ap * an + bn * bp == 0:
            cnt += 1
            break
#print(cnt)
ans = (2**(N-2*cnt)*3**cnt-1)%mod            
print(ans)