import sys
import math
from collections import defaultdict
from collections import deque
from fractions import Fraction

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def main():
    N = NI()
    AB = defaultdict(int)
    Y, Z = 0, 0
    for i in range(N):
        a, b = NMI()
        if a == b == 0:
            Z += 1
            continue
        if b == 0:
            Y += 1
            continue
        AB[Fraction(a, b)] += 1
    C = defaultdict(lambda: ())
    ans = 1
    for ab, k in list(AB.items()):
        a = ab.numerator
        b = ab.denominator
        if a > 0:
            t = AB[Fraction(-b, a)]
        elif a < 0:
            if Fraction(b, -a) not in AB:
                ans = ans * 2 % MOD
            continue
        else:
            t = Y
        C[(a, b)] = (k, t)

    for k, t in list(C.values()):
        tmp = pow(2, k, MOD) + pow(2, t, MOD) - 1
        ans = ans * tmp % MOD
    print((ans + Z - 1)%MOD)


if __name__ == "__main__":
    main()