MOD = 10**9+7
import sys
from collections import Counter
from math import gcd
def input():
	return sys.stdin.readline()[:-1]
n = int(input())
ans = 0
c = Counter()
zero = False
for _ in range(n):
	a, b = map(int, input().split())
	if a == b == 0:
		zero = True
		continue
	if a < 0:
		a, b = -a, -b
	if a == 0:
		a, b = 0, 1
	if b == 0:
		a, b = 1, 0
	g = gcd(a, b)
	c[(a//g, b//g)] += 1

ans = 1
for k, v in c.items():
	#print(k, v)
	if k[1] <= 0:
		x, y = -k[1], k[0]
		if c[(x, y)] > 0:
			continue
	else:
		x, y = k[1], -k[0]
	res = 0
	res += pow(2, v, MOD) - 1
	res += pow(2, c[(x, y)], MOD) - 1
	res += 1
	ans *= res
	ans %= MOD

if not zero:
	ans -= 1
ans %= MOD
print(ans)