from math import gcd
import collections

n = int(input())
mod = 10**9 + 7

data = []

def yakubun(x, y):
	x, y = abs(x), abs(y)
	y_targ = gcd(x, y)
	return x//y_targ, y//y_targ

"""
ここから本題
"""

for i in range(n):
	a, b = map(int,input().split())
	if a == 0 and b == 0:
		data.append((0, 0))
	elif a == 0:
		data.append((0, 1))
	elif b == 0:
		data.append((1, 0))
	else:
		tmpa, tmpb = yakubun(a, b)
		if a * b < 0:
			data.append((-tmpa, tmpb))
		else:
			data.append((tmpa, tmpb))

print(data)
datacnt = collections.Counter(data)
ans = (pow(2, n, mod)-1) % mod
settansaku = set([])

for i, j in datacnt.most_common():
	out = 0
	if (i, j) in settansaku:
		continue
	if i * j < 0:
		out += datacnt[(j, -i)]
		settansaku.add((j, -i))
	elif i * j == 0:
		out += datacnt[(j, i)]
		settansaku.add((j, i))
	else:
		out += datacnt[(-j, i)]
		settansaku.add((-j, i))
	if out != 0:
		pass

print(ans)