import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
import sys

# sys.stdout.write(str(n)+"\n")
MODULO = 1000000007
INF = 1e18+10

n = int(input())
a_b_value_count = {}
m_b_a_value_count = {}
zeroes = 0

for i in range(n):
	a, b = map(int, input().split())

	if a == 0 and b == 0:
		zeroes += 1
	else:
		if a == 0:
			a_b = 0
			m_b_a = INF
		elif b == 0:
			a_b = INF
			m_b_a = 0
		else:
			a_b = a / b
			m_b_a = -b / a

		a_b_value_count[a_b] = a_b_value_count.get(a_b, 0) + 1
		m_b_a_value_count[m_b_a] = m_b_a_value_count.get(m_b_a, 0) + 1

a_b = list(set(a_b_value_count.keys()))
m_b_a = [-1/item for item in a_b]

# a_b.sort()
# m_b_a.sort(reverse=True)


# print("a_b", a_b)
# print("a_b_value_count", a_b_value_count)
# print()

# print("m_b_a", m_b_a)
# print("m_b_a_value_count", m_b_a_value_count)

if len(a_b) != len(m_b_a):
	# print("Error!")
	exit()

n = len(a_b)
used = [False for _ in range(n)]

mba_to_ind = {}
for i in range(n):
	mba_to_ind[m_b_a[i]] = i

ans = 1
for i in range(n):
	# print("i", i)
	if not used[i]:
		a_b_key = a_b[i]
		# print("a_b_key", a_b_key)
		# if not connected
		if a_b_key not in m_b_a_value_count:
			# print("not connected")
			ans *= pow(2, a_b_value_count[a_b_key], MODULO)
			ans %= MODULO
			used[i] = True
			# for j in a_b_value_indices[a_b[i]]:
			# 	used[j] = True
		else:
			# print(" connected")
			s = a_b_value_count[a_b_key]
			t = m_b_a_value_count[a_b_key]
			# print("s, t", s, t)
			ans *= (1*pow(2, s, MODULO) + 1*pow(2, t, MODULO) -1)
			ans %= MODULO

			# for j in a_b_value_indices[a_b[i]]:
			used[i] = True
			# for j in m_b_a_value_indices[a_b[i]]:
			used[mba_to_ind[a_b_key]] = True
	# print("ans", ans)
	# print("used", used)
	# print()


			# used_a_b_keys.add(a_b_key)
			# used_a_b_keys.add(-1/a_b_key)


# -1 is for empty
print((ans-1+zeroes) % MODULO)