from fractions import Fraction



a = int(input())
resab = dict()
resba = dict()
res0 = 0

for i in range(a):
    ai, bi = [int(i) for i in input().split()]
    if ai != 0 and bi != 0:
        s = Fraction(ai, bi)
        if s not in resab:
            resab[s] = 1
        else:
            resab[s] += 1
        b = Fraction(-s.denominator, s.numerator)
        if b not in resba:
            resba[b] = 1
        else:
            resba[b] += 1
    else:
        res0 += 1

ans = 1
for i in list(resab.keys()):
    if i in resba and i in resab:
        ans *= (2**resab[i] - 1 + 2**resba[i]) 
        #print(ans, i)
        del resab[i]
        del resab[Fraction(-i.denominator, i.numerator)]
        del resba[i]
        del resba[Fraction(-i.denominator, i.numerator)]
    elif i in resba:
        ans *= resba[i] + 1
        del resba[i]
        try:
            del resab[Fraction(-i.denominator, i.numerator)]
        except:
            pass
    elif i in resab:
        ans *= resab[i] + 1
        del resab[i]
        try:
            del resba[Fraction(-i.denominator, i.numerator)]
        except:
            pass
        
    ans %= 1000000007

if res0 == a:
    print(0)
else:
    ans *= (res0 + 1)
    ans -= 1
    ans %= 1000000007
    print(ans)