import sys
from collections import namedtuple, defaultdict
from math import gcd
input = sys.stdin.readline

class Point:
    def __init__(self, x, y):
        g = gcd(abs(x), abs(y))

        x //= g
        y //= g

        if x < 0:
            x *= -1
            y *= -1

        self.x = x
        self.y = y

    def __eq__(self, other):
        return self.x == other.x and self.y == other.y

    def __hash__(self):
        return hash((self.x, self.y))

    def __repr__(self):
        return f'({self.x}, {self.y})'

def main():
    n = int(input())
    
    p = []
    d = defaultdict(lambda: 0)

    for _ in range(n):
        x, y = map(int, input().split())


        p.append(Point(x, y))
        d[p[-1]] += 1

    # print(d)

    MOD = 10 ** 9 + 7

    pw = [ pow(2, i, MOD) for i in range(n + 1) ]

    ans = 1
    tot = 0

    # pair = 0
    # for x in range(n):
    #     for y in range(x + 1, n):
    #         if p[x].x * p[y].x + p[x].y * p[y].y == 0:
    #             pair += 1

    # print(f'pairs = {pair}')

    for x in d.keys():
        if x.x > 0 and x.y >= 0 and x in d and Point(-x.y, x.x) in d:
            s = d[x]
            t = d[Point(-x.y, x.x)]

            # print(s, t)

            tot += s + t
            value = (pw[s] + pw[t] - 1 + MOD) % MOD
            ans = ans * value % MOD

    # print(f'tot={tot}, n={n}')

    ans = ans * pw[n - tot] % MOD
    ans = (ans - 1 + MOD) % MOD

    print(ans)
main()
