def main():
    #from fractions import Fraction
    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*n]
    adb = dict()
    ans = 0
    mod = 10**9+7
    for a, b in ab:
        if a == b == 0:
            ans += 1
            continue
        if b != 0:
            adb[a/b] = adb.get(a/b, 0)+1
        else:
            adb[None] = adb.get(None, 0)+1
    ans2 = 1
    for i, j in adb.items():
        if i == None:
            k = 0
        elif i == 0:
            k = None
        else:
            k = -1/i
        if k not in adb:
            ans2 = ans2*pow(2, j, mod) % mod
        else:
            if i is None:
                continue
            if i >= 0:
                ans2 = ans2*(pow(2, j, mod)+pow(2, adb[k], mod)-1) % mod
    ans2 = (ans2-1) % mod
    print((ans+ans2) % mod)


main()
