N = int(input())
rad_dic = {}
ans = 0
for i in range(N):
    A,B = map(int,input().split())
    a = A//math.gcd(abs(A), abs(B))
    b = B//math.gcd(abs(A), abs(B))
    if (a,b) not in rad_dic:
        rad_dic[(a,b)]= 1
        c = 0
    else:
        c = rad_dic[(a,b)]
        rad_dic[(a,b)] += 1
    n = 0
    if (-b,a) in rad_dic:
        n += rad_dic[(-b,a)]
    if (b,-a) in rad_dic:
        n += rad_dic[(b,-a)]
    if n == 0:
        ans *= 2
    else:
        ans += ans//2 + (2**n-1)*2**(i-n-c)
    ans %= 1000000007
print((pow(2,N)-1-ans)%1000000007)