n = int(input())
zeros = 0
m = {}

mod = 10**9 + 7

def pmod(a, x) :
	if x == 0 :
		return 1
	sq = pmod(a,x//2)
	sq = (sq * sq) % mod
	if x%2 == 0 :
		return sq
	return (sq * a) % mod

def gcd(a, b):
	if a == 0 : 
		return b
	return gcd(b%a, a);

for _ in range(n):
	a,b = map(int, input().split())
	if a == 0 and b == 0:
		zeros += 1
		continue
	d = gcd(abs(a), abs(b))
	a, b = a/d, b/d;
	if a < 0 :
		a, b = -a, -b
	if a == 0 and b < 0 :
		b = -b
	if (a,b) in m :
		m[(a,b)] += 1;
	else :
		m[(a,b)] = 1

ans = 1
for u in m:
	ile = m[u]
	a, b = u[0], u[1]
	m[u] = 0
	ile2 = 0
	inv = (b, -a)
	if (b < 0) :
		inv = (-b, a)
	if b == 0 and a > 0 :
		inv = (0, 1)
	if inv in m:
		ile2 = m[inv]
		m[inv] = 0
	ans = (ans * (pmod(2, ile) + pmod(2, ile2) - 1)) % mod;

print ( (ans  - 1+mod) % mod)
