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_value_count = {} # a_b values
m_b_a_value_count = {} # a_b values

a_b_used = [False for _ in range(n)]
# m_b_a_used = [False for _ in range(n)]
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 = 0
			m_b_a = INF
		elif b[i] == 0:
			a_b = INF
			m_b_a = 0
		else:
			a_b = a[i] / b[i]
			m_b_a = -b[i] / a[i]

		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

ans = 1
for a_b_key in a_b_used.keys():
	if not a_b_used[a_b_key]:
		# not connected
		if m_b_a_value_count[a_b_key] == 1:
			ans *= pow(2, a_b_value_count[a_b_keys], MODULO)
			ans %= MODULO
			a_b_used[a_b_key] = True
			# m_b_a_used[-1/a_b_key] = True
		else:
			a = a_b_value_count[a_b_keys]
			b = m_b_a_value_count[a_b_keys]
			ans *= ((1*pow(2, a, MODULO) + 1*pow(2, b, MODULO) -1) % MODULO)
			ans %= MODULO

			a_b_used[a_b_keys] = True
			a_b_used[-1/a_b_keys] = True


	# if not used[i]:
	# 	if len(graph[i]) == 0:
	# 		used[i] = True
	# 		ans *= 2
	# 		ans %= MODULO
	# 	else:
	# 		chet, nechet = 0, 0
	# 		# for item in 
	# 		a, b = dfs_chet_nechet(i)
	# 		ans *= ((1*pow(2, a, MODULO) + 1*pow(2, b, MODULO) -1) % MODULO)
	# 		# ans *= comb(i)
	# 		ans %= MODULO

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