import sys

# import re
import math
import collections
# import decimal
# import bisect
# import itertools
# import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()

    d = []
    d_to_hi = {}
    hi = {}

    for i in range(n):
        a, b = ns()
        d.append((a, b))
        gcd = math.gcd(abs(a), abs(b))

        gcd_a = a // gcd
        gcd_b = b // gcd
        d_to_hi[(a, b)] = (gcd_a, gcd_b)

        if (gcd_a, gcd_b) in hi.keys():
            hi[(gcd_a, gcd_b)] += 1
        else:
            hi[(gcd_a, gcd_b)] = 1

    badcomb = 0
    for a, b in d:
        gcd_a, gcd_b = d_to_hi[(a, b)]
        if (gcd_b, -gcd_a) in hi.keys():
            badcomb += hi[(gcd_b, -gcd_a)]
        if (-gcd_b, gcd_a) in hi.keys():
            badcomb += hi[(-gcd_b, gcd_a)]

    badcomb //= 2
    badcomb %= MOD

    total = pow(2, n, MOD) - 1
    tmp = (pow(2, n - 2, MOD)) % MOD
    total -= badcomb * tmp % MOD
    total %= MOD
    print(total)


if __name__ == '__main__':
    main()
