from fractions import Fraction
import sys
def input():
    return sys.stdin.readline().rstrip('\n')

ZERO = Fraction(0, 1)
Z = 1000000007

def z_pow(a, n):
    # a ^ n
    if n == 0:
        return 1
    if n == 1:
        return a % Z
    m = n // 2
    i = n - m * 2
    x = z_pow(a, m)
    return (x * x * z_pow(a, i)) % Z

def calc(N, G):
    zz = 0
    r = {}
    for a, b in G:
        if b == 0:
            if a == 0:
                zz += 1
            else:
                if ZERO in r:
                    r[ZERO][1] += 1
                else:
                    r[ZERO] = [0, 1]
        else:
            if a == 0:
                if ZERO in r:
                    r[ZERO][0] += 1
                else:
                    r[ZERO] = [1, 0]
            else:
                p = Fraction(a, b)
                n = Fraction(-b, a)
                if p in r:
                    r[p][0] += 1
                elif n in r:
                    r[n][1] += 1
                else:
                    r[p] = [1, 0]
    ans = 1
    for frac in r:
        ans = (ans * (z_pow(2, r[frac][0]) + z_pow(2, r[frac][1]) - 1)) % Z
    return ans + zz - 1

    

N = int(input())
G = [tuple([int(s) for s in input().split()]) for _ in range(N)]
print(calc(N, G))