from sys import stdin
from collections import deque, Counter, defaultdict
from fractions import gcd
import heapq

INF = int(1e10)
MOD = int(1e9 + 7)

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def input():
    return stdin.readline()[:-1]

def main():
    from builtins import int, map
    n = int(input())
    count = 0
    A, B = [], []
    mp = {}
    for i in range(n):
        ai, bi = map(int, input().split())
        if ai == 0 and bi == 0:
            count += 1
            continue

        gi = gcd(ai, bi)
        ai = ai // gi
        bi = bi // gi

        if bi < 0:
            ai = -ai
            bi = -bi
        if bi == 0 and ai < 0:
            ai = -ai
            bi = -bi
        rot90 = ai <= 0
        if rot90:
            ai, bi = bi, -ai

        if (ai, bi) not in mp:
            mp[(ai, bi)] = [0, 0]
        if rot90:
            mp[(ai, bi)][0] += 1
        else:
            mp[(ai, bi)][1] += 1

    ans = 1
    for key in mp:
        s, t = mp[key]
        now = 1
        now = (now + power(2, s, MOD) - 1) % MOD
        now = (now + power(2, t, MOD) - 1) % MOD
        ans = (ans * now) % MOD
    ans -= 1
    ans += count
    print(ans)


if __name__ == '__main__':
    main()