n = int(input())
t = []#num a/b
l = []#num p,m
z = [0,0,0,0]
d = 10
e = 0
for i in range(d):
    t.append([])
    l.append([])
for i in range(n):
    a,b = map(int,input().split())
    if(a*b == 0):
        if(a + b != 0):
            if(a == 0):
                z[0] += 1
            else:
                z[1] += 1
        else:
            e = 1
    elif(abs(a)== abs(b)):
        if(a*b > 0):
            z[2] += 1
        else:
            z[3] += 1
    elif(abs(a/b) > 1):
        u = abs(a/b)
        m = int(u%d)
        if(u in t[m]):
            if(a*b >= 0):
                l[m][t[m].index(u)][0] += 1
            else:
                l[m][t[m].index(u)][1] += 1
        else:
            t[m].append(u)
            if(a*b > 0):
                l[m].append([1,0,0,0])
            else:
                l[m].append([0,1,0,0])
    else:
        u = abs(b/a)
        m = int(u%d)
        if(u in t[m]):
            if(a*b >= 0):
                l[m][t[m].index(u)][2] += 1
            else:
                l[m][t[m].index(u)][3] += 1
        else:
            t[m].append(u)
            if(a*b > 0):
                l[m].append([0,0,1,0])
            else:
                l[m].append([0,0,0,1])
ans = 2**z[0]+2**z[1]-1
ans *= 2**z[2]+2**z[3]-1
for i in range(d):
    for j in range(len(t[i])):
        com1 = 2**l[i][j][0]+2**l[i][j][3]-1
        com2 = 2**l[i][j][1]+2**l[i][j][2]-1
        ans *= com1
        ans *= com2
        ans %= 1000000007
print(ans%1000000007 -1 + e)