from sys import stdin
from sys import setrecursionlimit
from queue import deque
from math import factorial
setrecursionlimit(10 ** 7)

mod = 10**9+7

dic = {}
p = 0

n = int(stdin.readline().rstrip())
for i in range(n):
    a,b = map(int,stdin.readline().rstrip().split())
    if a == 0 and b == 0:
        p += 1
        continue
    if b == 0:
        if "s" not in dic:
            dic["s"] = 1
        else:
            dic["s"] += 1
        continue
    if str(-a/b) in dic:
        dic[str(-a/b)] += 1
    else:
        dic[str(-a/b)] = 1

point = 0
le = 0
li = []

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))#組み合わせ

for i,j in dic.items():
    if i == "s":
        if "0" in dic:
            point += j
            point %= mod
    elif i == "0":
        if "s" in dic:
            point += j
            point %= mod
    else:
        li.append(str(-1/float(i)))
        if str(-1/float(i)) in dic:
            point += j
            le += 1

print(2**len(dic)%mod-2**(n-point)%mod-1)