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 = [0 for i in range(n)]
b = [0 for i in range(n)]

a_b = [0 for i in range(n)]
m_b_a = [0 for i in range(n)]

# a_b_value_count = {} # a_b values
# m_b_a_value_count = {} # a_b values

a_b_value_indices = {} # a_b values
m_b_a_value_indices = {} # a_b values

# used_a_b_keys = set()
used = [False for _ in range(n)]

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

	if a[i] == 0 and b[i] == 0:
		zeroes += 1
		used[i] = True
	else:
		if a[i] == 0:
			a_b[i] = 0
			m_b_a[i] = INF
		elif b[i] == 0:
			a_b[i] = INF
			m_b_a[i] = 0
		else:
			a_b[i] = a[i] / b[i]
			m_b_a[i] = -b[i] / a[i]

		# a_b_value_count[a_b] = a_b_value_count.get(a_b, 0) + 1
		a_b_value_indices[a_b[i]] = a_b_value_indices.get(a_b[i], []) + [i]

		# m_b_a_value_count[m_b_a] = m_b_a_value_count.get(m_b_a, 0) + 1
		m_b_a_value_indices[m_b_a[i]] = m_b_a_value_indices.get(m_b_a[i], []) + [i]

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

			for j in a_b_value_indices[a_b[i]]:
				used[j] = True
			for j in m_b_a_value_indices[a_b[i]]:
				used[j] = True

			# 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)