We have caught N sardines. The deliciousness and fragrantness of the i-th sardine is A_i and B_i, respectively.
We will choose one or more of these sardines and put them into a cooler. However, two sardines on bad terms cannot be chosen at the same time.
The i-th and j-th sardines (i \neq j) are on bad terms if and only if A_i \cdot A_j + B_i \cdot B_j = 0.
In how many ways can we choose the set of sardines to put into the cooler? Since the count can be enormous, print it modulo 1000000007.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 2 \times 10^5
 - -10^{18} \leq A_i, B_i \leq 10^{18}

-----Input-----
Input is given from Standard Input in the following format:
N
A_1 B_1
:
A_N B_N

-----Output-----
Print the count modulo 1000000007.

-----Sample Input-----
3
1 2
-1 1
2 -1

-----Sample Output-----
5

There are five ways to choose the set of sardines, as follows:
 - The 1-st
 - The 1-st and 2-nd
 - The 2-nd
 - The 2-nd and 3-rd
 - The 3-rd

Difficulty: MEDIUM

Solutions:
import math
n = int(input())
from collections import defaultdict
d = defaultdict(list)
s = set()
zc = 0
for i in range(n):
	(a, b) = map(int, input().split())
	g = math.gcd(a, b)
	if g != 0:
		a //= g
		b //= g
		if a < 0:
			(a, b) = (-a, -b)
		elif a == 0 and b < 0:
			b *= -1
		d[a, b].append(i)
	if a == b == 0:
		zc += 1
v = 1
s = set()
M = 10 ** 9 + 7
for ((a, b), val) in d.items():
	(aa, bb) = (b, -a)
	if aa < 0:
		(aa, bb) = (-aa, -bb)
	elif aa == 0 and bb < 0:
		bb *= -1
	if (a, b) in s or (aa, bb) in s:
		continue
	if (aa, bb) in d.keys():
		v *= pow(2, len(val), M) + pow(2, len(d[aa, bb]), M) - 1
	else:
		v *= pow(2, len(val), M)
	v %= M
	s.add((a, b))
	s.add((aa, bb))
v -= 1
v += zc
print(v % M)


import sys
import math
from math import gcd
mod = 1000000007
N = int(sys.stdin.readline().strip())
zero = 0
mp = {}
for _ in range(N):
	(a, b) = map(int, sys.stdin.readline().strip().split())
	if a == 0 and b == 0:
		zero += 1
		continue
	g = gcd(a, b)
	a = a // g
	b = b // g
	if b < 0:
		a = -a
		b = -b
	if b == 0 and a < 0:
		a = -a
	if a <= 0:
		(a, b) = (b, -a)
		if (a, b) in mp:
			mp[a, b][0] += 1
		else:
			mp[a, b] = [1, 0]
	elif (a, b) in mp:
		mp[a, b][1] += 1
	else:
		mp[a, b] = [0, 1]
ans = 1
for key in mp:
	(s, t) = mp[key]
	ans *= pow(2, s, mod) + pow(2, t, mod) - 1
	ans %= mod
print((zero - 1 + ans) % mod)


from collections import defaultdict, deque
import math
kMod = 1000000007
N = int(input())
key2count = defaultdict(lambda : [0, 0])
for _ in range(N):
	(a, b) = map(int, input().split())
	g = math.gcd(a, b)
	if a < 0 or (a == 0 and b < 0):
		(a, b) = (-a, -b)
	if g > 0:
		(a, b) = (a // g, b // g)
	idx = 0
	if b <= 0:
		idx = 1
		(a, b) = (-b, a)
	key2count[a, b][idx] += 1
ans = 1
for (key, val) in key2count.items():
	if key == (0, 0):
		continue
	(plus, minus) = val
	ans *= pow(2, plus, kMod) + pow(2, minus, kMod) - 1
	ans %= kMod
ans += sum(key2count[0, 0])
print((ans + kMod - 1) % kMod)


import sys
from collections import defaultdict
from math import gcd
mod = 1000000007
N = int(input())

def reduce(vec):
	vec = list(vec)
	if vec[0] == 0:
		if vec[1] == 0:
			return (0, 0)
		else:
			return (0, 1)
	elif vec[1] == 0:
		return (1, 0)
	else:
		if vec[0] < 0:
			vec[0] = -vec[0]
			vec[1] = -vec[1]
		d = gcd(vec[0], vec[1])
		return (vec[0] // d, vec[1] // d)
counter0 = defaultdict(int)
counter1 = defaultdict(int)
origin = 0
for i in range(N):
	(a, b) = list(map(int, input().split()))
	if a == 0 and b == 0:
		origin += 1
		continue
	(a, b) = reduce((a, b))
	if b > 0:
		counter0[a, b] += 1
	else:
		counter0[-b, a] += 0
		counter1[-b, a] += 1
ans = origin
k = 1
for (key, cnt0) in list(counter0.items()):
	cnt1 = counter1[key]
	tmp = (pow(2, cnt0, mod) + pow(2, cnt1, mod) - 1) % mod
	k = k * tmp % mod
ans = ans + k - 1
ans %= mod
print(ans)


import math
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
MOD = 1000000007
dic1 = {}
a_zero = 0
b_zero = 0
both_zero = 0
for (a, b) in AB:
	if a == 0 and b != 0:
		a_zero += 1
	elif a != 0 and b == 0:
		b_zero += 1
	elif a == 0 and b == 0:
		both_zero += 1
	else:
		g = math.gcd(a, b)
		a //= g
		b //= g
		if b < 0:
			(a, b) = (-a, -b)
		if (a, b) in dic1:
			dic1[a, b] += 1
		else:
			dic1[a, b] = 1
pair = []
used = set()
for (key, val) in list(dic1.items()):
	if key in used:
		continue
	(a, b) = key
	used.add((a, b))
	cnt = 0
	if a < 0:
		(c, d) = (-b, -a)
	else:
		(c, d) = (b, a)
	if (-c, d) in dic1:
		cnt += dic1.get((-c, d), 0)
		used.add((-c, d))
	pair.append((val, cnt))
all_cnt = 1
for (cnt1, cnt2) in pair:
	all_cnt *= pow(2, cnt1, MOD) + pow(2, cnt2, MOD) - 1
	all_cnt %= MOD
if a_zero != 0 or b_zero != 0:
	all_cnt *= pow(2, a_zero, MOD) + pow(2, b_zero, MOD) - 1
	all_cnt %= MOD
all_cnt += both_zero
all_cnt %= MOD
print((all_cnt - 1) % MOD)


from math import gcd
MOD = 10 ** 9 + 7
N = int(input())
d = dict()
zeros = 0
a_zeros = 0
b_zeros = 0
for _ in range(N):
	(a, b) = tuple(map(int, input().split()))
	if not any((a, b)):
		zeros += 1
		continue
	if not a:
		a_zeros += 1
		continue
	if not b:
		b_zeros += 1
		continue
	g = gcd(a, b) * (a // abs(a))
	p = (a // g, b // g)
	d[p] = d.get(p, 0) + 1
counts = dict()
for (k, v) in d.items():
	(a, b) = k
	if counts.get((b, -a), False) or counts.get((-b, a), False):
		continue
	counts[k] = (v, d.get((b, -a), 0) + d.get((-b, a), 0))
total = 1
for (k, v) in counts.items():
	(a, b) = v
	total = total * (pow(2, a, MOD) + pow(2, b, MOD) - 1) % MOD
total = total * (pow(2, a_zeros, MOD) + pow(2, b_zeros, MOD) - 1) % MOD
print((total + zeros + MOD - 1) % MOD)


from math import gcd
from collections import defaultdict
N = int(input())
MOD = 10 ** 9 + 7
zero_zero_num = 0
fishes = defaultdict(int)
for i in range(N):
	(a, b) = list(map(int, input().split()))
	if a == 0 and b == 0:
		zero_zero_num += 1
	elif a == 0:
		fishes[0, -1] += 1
	elif b == 0:
		fishes[1, 0] += 1
	else:
		g = gcd(a, b)
		(a, b) = (a // g, b // g)
		if a > 0 and b > 0 or (a < 0 and b < 0):
			fishes[abs(a), abs(b)] += 1
		else:
			(a, b) = (-a, -b) if a < 0 else (a, b)
			fishes[a, b] += 1
ans = 1
keys = list(fishes.keys())
visited = set()
for (kai, kbi) in keys:
	if kbi >= 0:
		(kaj, kbj) = (kbi, -kai)
	else:
		(kaj, kbj) = (-kbi, kai)
	if (kai, kbi) in visited or (kaj, kbj) in visited:
		continue
	ans *= 1 + (pow(2, fishes[kai, kbi], MOD) - 1) + (pow(2, fishes[kaj, kbj], MOD) - 1)
	ans %= MOD
	visited.add((kai, kbi))
	visited.add((kaj, kbj))
print((ans + zero_zero_num - 1) % MOD)


import math

def main():
	N = int(input())
	d = {}
	za = zb = zab = r = 0
	mod = 10 ** 9 + 7
	for i in range(N):
		(a, b) = list(map(int, input().split()))
		if a == 0 and b == 0:
			zab += 1
		elif b == 0:
			zb += 1
		elif a == 0:
			za += 1
		else:
			if a < 0:
				(a, b) = (-a, -b)
			x = math.gcd(abs(a), abs(b))
			d[a // x, b // x] = d.get((a // x, b // x), 0) + 1
	used = set()
	l = []
	for x in d:
		if x in used:
			continue
		(a, b) = (x[0], x[1])
		used.add(x)
		if a * b > 0:
			t = (abs(b), -abs(a))
		else:
			t = (abs(b), abs(a))
		used.add(t)
		l.append((d[x], d.get(t, 0)))
	r = pow(2, za) + pow(2, zb) - 1
	for i in l:
		r *= pow(2, i[0]) + pow(2, i[1]) - 1
		r %= mod
	return (r - 1 + zab) % mod
print(main())


N = int(input())
from collections import defaultdict
dic = defaultdict(int)
import math
mod = 1000000007
for _ in range(N):
	(A, B) = list(map(int, input().split()))
	if A < 0:
		(A, B) = (-A, -B)
	if A == 0:
		if B == 0:
			dic[0, 0] += 1
		else:
			dic[0, 1] += 1
	elif B == 0:
		dic[1, 0] += 1
	else:
		gcd = math.gcd(A, B)
		(A, B) = (A // gcd, B // gcd)
		dic[A, B] += 1
ans = 1
N -= dic[0, 0]
for (k, v) in list(dic.items()):
	if k == (0, 0) or k == (0, 1):
		continue
	if k == (1, 0):
		if not (0, 1) in dic:
			continue
		v_dash = dic[0, 1]
		ans *= pow(2, v, mod) - 1 + (pow(2, v_dash, mod) - 1) + 1
		ans %= mod
		N -= v + v_dash
		continue
	(a, b) = k
	if not (b, -a) in dic:
		continue
	v_dash = dic[b, -a]
	ans *= pow(2, v, mod) - 1 + (pow(2, v_dash, mod) - 1) + 1
	ans %= mod
	N -= v + v_dash
ans *= pow(2, N, mod)
ans += dic[0, 0] - 1
ans %= mod
print(ans)


import sys
from collections import Counter
from math import gcd
input = sys.stdin.readline
N = int(input())
mod = 10 ** 9 + 7
d = Counter()
a = [tuple(map(int, input().split())) for _ in range(N)]
z = 0
for (x, y) in a:
	if (x, y) == (0, 0):
		z += 1
		continue
	if y < 0:
		x *= -1
		y *= -1
	if x == 0:
		x = 0
		y = 1
	elif y == 0:
		x = 1
		y = 0
	g = gcd(x, y)
	x //= g
	y //= g
	d[x, y] += 1
res = 1
itr = list(d.keys())
for (x, y) in itr:
	t = 0
	if x <= 0 and d[y, -x] > 0:
		continue
	if (x, y) == (1, 0):
		t = d[0, 1]
	else:
		t = d[-y, x]
	v = 0
	v += pow(2, d[x, y], mod) - 1
	v %= mod
	v += pow(2, t, mod) - 1
	v %= mod
	v += 1
	v %= mod
	res *= v
	res %= mod
print((res - 1 + z) % mod)


import math
mod = 10 ** 9 + 7
n = int(input())
d = {}
d0 = 0
for _ in range(n):
	(a, b) = map(int, input().split())
	g = math.gcd(a, b)
	if g == 0:
		d0 += 1
	else:
		a //= g
		b //= g
		if a < 0:
			a = -a
			b = -b
		elif a == 0 and b < 0:
			b = -b
		if (a, b) in d:
			d[a, b] += 1
		else:
			d[a, b] = 1
ans = 1
for (a, b) in d.keys():
	if d[a, b] > 0:
		t = 2 ** d[a, b]
		if b <= 0:
			a = -a
			b = -b
		if (b, -a) in d:
			t += 2 ** d[b, -a] - 1
			d[b, -a] = 0
		ans *= t
		ans %= mod
print((ans + d0 - 1) % mod)


from math import gcd
from collections import defaultdict
mod = 10 ** 9 + 7
n = int(input())
mp = defaultdict(lambda : [0, 0])
zero_zero = 0
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a == 0 and b == 0:
		zero_zero += 1
		continue
	g = gcd(a, b)
	a //= g
	b //= g
	rot_cnt = 0
	while not (a > 0 and b >= 0):
		(a, b) = (-b, a)
		rot_cnt += 1
	mp[a, b][rot_cnt % 2] += 1
ans = 1
for (s, t) in list(mp.values()):
	now = (pow(2, s, mod) + pow(2, t, mod) - 1) % mod
	ans = ans * now % mod
ans = (ans - 1 + zero_zero) % mod
print(ans)


from collections import defaultdict
from math import gcd

def GCD(a, b):
	gc = gcd(a, b)
	a //= gc
	b //= gc
	return (a, b)
zero = 0
First_quadrant = defaultdict(int)
Second_quadrant = defaultdict(int)
n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zero += 1
	elif a * b >= 0 and b != 0:
		First_quadrant[GCD(abs(a), abs(b))] += 1
	else:
		Second_quadrant[GCD(abs(b), abs(a))] += 1
		First_quadrant[GCD(abs(b), abs(a))] += 0
ans = 1
for (key1, val) in First_quadrant.items():
	v2 = Second_quadrant[key1]
	ans *= 2 ** val + 2 ** v2 - 1
	ans %= 10 ** 9 + 7
ans = ans + zero - 1
ans %= 10 ** 9 + 7
print(ans)


from collections import defaultdict
from math import gcd as g
n = int(input())
mod = 10 ** 9 + 7
sardines = set()
Ddic = defaultdict(int)
ans = 1
zcount = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zcount += 1
		continue
	if a == 0:
		Ddic[0, 1] += 1
		sardines.add((0, 1))
		continue
	if b == 0:
		sardines.add((1, 0))
		Ddic[1, 0] += 1
		continue
	(A, B) = (abs(a), abs(b))
	G = g(A, B)
	a //= G
	b //= G
	if b < 0:
		a = -a
		b = -b
	Ddic[a, b] += 1
	sardines.add((a, b))
for i in sardines:
	if i == (0, 0) or (i[0] <= 0 and Ddic[i[1], -i[0]] != 0):
		continue
	if i[0] <= 0:
		ans *= 2 ** Ddic[i] + 2 ** Ddic[i[1], -i[0]] - 1
	else:
		ans *= 2 ** Ddic[i] + 2 ** Ddic[-i[1], i[0]] - 1
	ans %= mod
print((ans + zcount - 1) % mod)


mod = 10 ** 9 + 7
n = int(input())
from collections import defaultdict
d = defaultdict(int)
z = 0
from math import gcd
for i in range(n):
	(x, y) = map(int, input().split())
	if x == y == 0:
		z += 1
	else:
		f = gcd(x, y)
		x //= f
		y //= f
		if x < 0:
			x *= -1
			y *= -1
		if x == 0 and y < 0:
			y = -y
		d[x, y] += 1
ans = 1
for (a, s) in d:
	if d[a, s] == 0:
		continue
	ng = 0
	if (s, -a) in d:
		ng += d[s, -a]
		d[s, -a] = 0
	if (-s, a) in d:
		ng += d[-s, a]
		d[-s, a] = 0
	ans *= (pow(2, d[a, s], mod) - 1 + pow(2, ng, mod) - 1 + 1) % mod
	ans %= mod
	d[a, s] = 0
print((ans + z - 1) % mod)


from collections import Counter

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return abs(a)
MOD = 1000000007

def main():
	N = int(input())
	d = {}
	d[1, 0] = (0, 0)
	z = 0
	for i in range(N):
		(a, b) = (int(x) for x in input().split())
		g = gcd(a, b)
		if g != 0:
			a = a // g
			b = b // g
			if a * b < 0:
				a = -abs(a)
			elif a * b > 0:
				a = abs(a)
		b = abs(b)
		if a * b == 0:
			if a == b == 0:
				z += 1
			elif b == 0:
				d[1, 0] = (d[1, 0][0] + 1, d[1, 0][1])
			elif a == 0:
				d[1, 0] = (d[1, 0][0], d[1, 0][1] + 1)
		elif (a, b) in d:
			d[a, b] = (d[a, b][0] + 1, d[a, b][1])
		elif (b, -a) in d:
			d[b, -a] = (d[b, -a][0], d[b, -a][1] + 1)
		elif (-b, a) in d:
			d[-b, a] = (d[-b, a][0], d[-b, a][1] + 1)
		else:
			d[a, b] = (1, 0)
	ans = 1
	for (i, j) in list(d.values()):
		ans *= pow(2, i, MOD) + pow(2, j, MOD) - 1
		ans %= MOD
	print((ans - 1 + z) % MOD)

def __starting_point():
	main()
__starting_point()


from operator import itemgetter
from math import gcd
from collections import Counter
N = int(input())
mod = int(1000000000.0 + 7)
zero = 0
P = {}
for i in range(N):
	(a, b) = list(map(int, input().split()))
	if a == 0 and b == 0:
		zero += 1
		continue
	g = gcd(a, b)
	(a, b) = (a // g, b // g)
	if b < 0:
		(a, b) = (-a, -b)
	if b == 0 and a < 0:
		(a, b) = (-a, b)
	rot90 = a <= 0
	if rot90:
		(a, b) = (b, -a)
	if not (abs(a), b) in P:
		P[a, b] = [0, 0]
	if not rot90:
		P[a, b][0] += 1
	else:
		P[a, b][1] += 1
ans = 1
for (k, v) in P.items():
	(s, t) = v
	wk = 1 + pow(2, s, mod) - 1 + pow(2, t, mod) - 1
	ans *= wk
	ans %= mod
ans += zero
print((ans - 1) % mod)


from math import gcd
import math
import numpy as np
import decimal
import collections
import itertools
import sys
import random

class UnionFind:

	def __init__(self, n):
		self.n = n
		self.par = [-1 for i in range(self.n)]

	def find(self, x):
		if self.par[x] < 0:
			return x
		else:
			self.par[x] = self.find(self.par[x])
			return self.par[x]

	def unite(self, x, y):
		p = self.find(x)
		q = self.find(y)
		if p == q:
			return None
		if p > q:
			(p, q) = (q, p)
		self.par[p] += self.par[q]
		self.par[q] = p

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def size(self, x):
		return -self.par[self.find(x)]

def prime_numbers(x):
	if x < 2:
		return []
	prime_numbers = [i for i in range(x)]
	prime_numbers[1] = 0
	for prime_number in prime_numbers:
		if prime_number > math.sqrt(x):
			break
		if prime_number == 0:
			continue
		for composite_number in range(2 * prime_number, x, prime_number):
			prime_numbers[composite_number] = 0
	return [prime_number for prime_number in prime_numbers if prime_number != 0]

def is_prime(x):
	if x < 2:
		return False
	if x == 2 or x == 3 or x == 5:
		return True
	if x % 2 == 0 or x % 3 == 0 or x % 5 == 0:
		return False
	prime_number = 7
	difference = 4
	while prime_number <= math.sqrt(x):
		if x % prime_number == 0:
			return False
		prime_number += difference
		difference = 6 - difference
	return True

def prime_factorize(n):
	res = []
	while n % 2 == 0:
		res.append(2)
		n //= 2
	f = 3
	while f ** 2 <= n:
		if n % f == 0:
			res.append(f)
			n //= f
		else:
			f += 2
	if n != 1:
		res.append(n)
	return res
mod = 10 ** 9 + 7

class nCr:

	def __init__(self, n):
		self.n = n
		self.fa = [1] * (self.n + 1)
		self.fi = [1] * (self.n + 1)
		for i in range(1, self.n + 1):
			self.fa[i] = self.fa[i - 1] * i % mod
			self.fi[i] = pow(self.fa[i], mod - 2, mod)

	def comb(self, n, r):
		if n < r:
			return 0
		if n < 0 or r < 0:
			return 0
		return self.fa[n] * self.fi[r] % mod * self.fi[n - r] % mod

def extgcd(a, b, d=0):
	g = a
	if b == 0:
		(x, y) = (1, 0)
	else:
		(x, y, g) = extgcd(b, a % b)
		(x, y) = (y, x - a // b * y)
	return (x, y, g)

class BinaryIndexedTree:

	def __init__(self, n):
		self.n = n
		self.BIT = [0] * (self.n + 1)

	def add(self, i, x):
		while i <= self.n:
			self.BIT[i] += x
			i += i & -i

	def query(self, i):
		res = 0
		while i > 0:
			res += self.BIT[i]
			i -= i & -i
		return res

class AssociativeArray:

	def __init__(self, q):
		self.dic = dict()
		self.q = q

	def solve(self):
		for i in range(self.q):
			Query = list(map(int, input().split()))
			if Query[0] == 0:
				(x, y, z) = Query
				self.dic[y] = z
			else:
				(x, y) = Query
				if y in self.dic:
					print(self.dic[y])
				else:
					print(0)

def floor_sum(n, m, a, b):
	res = 0
	if a >= m:
		res += (n - 1) * n * (a // m) // 2
		a %= m
	if b >= m:
		res += n * (b // m)
		b %= m
	y_max = (a * n + b) // m
	x_max = y_max * m - b
	if y_max == 0:
		return res
	res += y_max * (n + -x_max // a)
	res += floor_sum(y_max, a, m, (a - x_max % a) % a)
	return res

def z_algorithm(s):
	str_len = len(s)
	res = [0] * str_len
	res[str_len - 1] = str_len
	(i, j) = (1, 0)
	while i < str_len:
		while i + j < str_len and s[i + j] == s[j]:
			j += 1
		res[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < str_len and j > res[k] + k:
			res[i + k] = res[k]
			k += 1
		i += k
		j -= k
	return res

class Manacher:

	def __init__(self, s):
		self.s = s

	def coustruct(self):
		(i, j) = (0, 0)
		s_len = len(self.s)
		res = [0] * s_len
		while i < s_len:
			while i - j >= 0 and i + j < s_len and (self.s[i - j] == self.s[i + j]):
				j += 1
			res[i] = j
			k = 1
			while i - k >= 0 and k + res[i - k] < j:
				k += 1
			i += k
			j -= k

def mod_sqrt(a, p):
	if a == 0:
		return 0
	if p == 2:
		return 1
	k = (p - 1) // 2
	if pow(a, k, p) != 1:
		return -1
	while True:
		n = random.randint(2, p - 1)
		r = (n ** 2 - a) % p
		if r == 0:
			return n
		if pow(r, k, p) == p - 1:
			break
	k += 1
	(w, x, y, z) = (n, 1, 1, 0)
	while k:
		if k % 2:
			(y, z) = (w * y + r * x * z, x * y + w * z)
		(w, x) = (w * w + r * x * x, 2 * w * x)
		w %= p
		x %= p
		y %= p
		z %= p
		k >>= 1
	return y
mod = 10 ** 9 + 7
n = int(input())
zeros = 0
count = dict()
for i in range(n):
	(a, b) = map(int, input().split())
	if (a, b) == (0, 0):
		zeros += 1
		continue
	g = gcd(abs(a), abs(b))
	a //= g
	b //= g
	cnt = 0
	while a < 0 or b <= 0:
		(a, b) = (-1 * b, a)
		cnt += 1
	if not (a, b) in count:
		count[a, b] = [0, 0]
	count[a, b][cnt % 2] += 1
ans = 1
for i in count:
	(a, b) = count[i]
	ans *= (pow(2, a, mod) + pow(2, b, mod) - 1) % mod
	ans %= mod
print((ans + zeros - 1) % mod)


from math import gcd
n = int(input())
mod = 10 ** 9 + 7
count = {}
num = 0
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		num += 1
		continue
	if a * b != 0:
		g = gcd(a, b) * (b // abs(b))
	elif a != 0:
		g = a
	else:
		g = b
	l = (a // g, b // g)
	count[l] = count.get(l, 0) + 1
mem = set()
ans = 1
for ((x, y), z) in count.items():
	if x * y == 0:
		k = (y, x)
	else:
		k = (-1 * x // abs(x) * y, abs(x))
	if k in mem:
		continue
	mem.add((x, y))
	ans *= pow(2, z) + pow(2, count.get(k, 0)) - 1
	ans %= mod
print((ans + num - 1) % mod)


from math import gcd
N = int(input())
AB = [map(int, input().split()) for _ in range(N)]
t = []
d = {}
d[0] = {}
d[0][0] = 0
for (a, b) in AB:
	i = gcd(a, b)
	if i != 0:
		a //= i
		b //= i
	t.append((a, b))
	d.setdefault(a, {})
	d[a].setdefault(b, 0)
	d[a][b] += 1
used = set()
result = 1
for (a, b) in t:
	if (a, b) in used:
		continue
	used.add((a, b))
	if a == 0 and b == 0:
		continue
	i = d[a][b]
	(j, k, l) = (0, 0, 0)
	if -a in d and -b in d[-a]:
		j = d[-a][-b]
		used.add((-a, -b))
	if -b in d and a in d[-b]:
		k = d[-b][a]
		used.add((-b, a))
	if b in d and -a in d[b]:
		l = d[b][-a]
		used.add((b, -a))
	result *= pow(2, i + j, 1000000007) + pow(2, k + l, 1000000007) - 1
	result %= 1000000007
result += d[0][0] - 1
result %= 1000000007
print(result)


from math import gcd
MOD = 10 ** 9 + 7
N = int(input())
d = {}
zero = 0
for i in range(N):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zero += 1
		continue
	flip = 0
	while not (a >= 0 and b > 0):
		(a, b) = (-b, a)
		flip ^= 1
	g = gcd(a, b)
	a //= g
	b //= g
	if not (a, b) in d:
		d[a, b] = [0, 0]
	d[a, b][flip] += 1
ans = 1
for (v1, v2) in d.values():
	ans *= pow(2, v1, MOD) + pow(2, v2, MOD) - 1
	ans %= MOD
ans -= 1
ans += zero
ans %= MOD
print(ans)


import math
from collections import defaultdict
n = int(input())
p = defaultdict(int)
mod = 10 ** 9 + 7
ori = 0
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == b == 0:
		ori += 1
		continue
	elif b < 0:
		a *= -1
		b *= -1
	elif b == 0 and a < 0:
		a *= -1
	if a == 0:
		p[0, 1] += 1
	elif b == 0:
		p[1, 0] += 1
	else:
		g = math.gcd(a, b)
		p[a // g, b // g] += 1
k = n - ori
ans = ori - 1
tmp = 1
l = k
for (q, num) in sorted(p.items(), reverse=True):
	(x, y) = q
	if x <= 0:
		break
	if p[-y, x] >= 1:
		(a, b) = (p[x, y], p[-y, x])
		tmp *= pow(2, a, mod) + pow(2, b, mod) - 1
		l -= a + b
tmp *= pow(2, l, mod)
print((ans + tmp) % mod)


import math
mod = 1000000007
n = int(input())
iwashi_group = {}
count = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a * b > 0:
		GCD = math.gcd(abs(a), abs(b))
		iwashi = (abs(a) // GCD, abs(b) // GCD)
		flag = True
	elif a * b < 0:
		GCD = math.gcd(abs(a), abs(b))
		iwashi = (abs(b) // GCD, abs(a) // GCD)
		flag = False
	elif a == 0 and b == 0:
		count += 1
		continue
	elif a == 0:
		iwashi = (0, 1)
		flag = True
	elif b == 0:
		iwashi = (0, 1)
		flag = False
	if iwashi in iwashi_group:
		if flag:
			iwashi_group[iwashi][0] += 1
		else:
			iwashi_group[iwashi][1] += 1
	elif flag:
		iwashi_group[iwashi] = [1, 0]
	else:
		iwashi_group[iwashi] = [0, 1]
ans = 1
for (a, b) in iwashi_group.values():
	ans = ans * (2 ** a + 2 ** b - 1) % mod
print((ans + count - 1) % mod)


from collections import defaultdict
from math import gcd
N = int(input())
d = defaultdict(int)
s = set()
ans = 0
mod = 1000000007

def change(A, B):
	if A == 0 and B == 0:
		return (0, 0)
	if A == 0:
		return (0, 1)
	if B == 0:
		return (1, 0)
	GCD = gcd(A, B)
	A //= GCD
	B //= GCD
	if A < 0:
		A *= -1
		B *= -1
	return (A, B)

def pair(key):
	if key == (1, 0):
		return (0, 1)
	(A, B) = key
	return (B, -A)
for i in range(N):
	(A, B) = map(int, input().split())
	(A, B) = change(A, B)
	if A == 0 and B == 0:
		ans += 1
	else:
		d[A, B] += 1
		if A == 0:
			(A, B) = (B, A)
		elif B < 0:
			(A, B) = (-B, A)
		s.add((A, B))
cnt = 1
for k in s:
	cnt *= pow(2, d[k], mod) + pow(2, d[pair(k)], mod) - 1
	cnt %= mod
cnt -= 1
ans += cnt
ans %= mod
print(ans)


from collections import defaultdict
from math import atan2, gcd
N = int(input())
MOD = 1000000007
d = defaultdict(lambda : [0, 0])
zero = 0
pos = []
neg = []
for _ in range(N):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zero += 1
		continue
	if a < 0:
		a = -a
		b = -b
	elif a == 0 and b > 0:
		b = -b
	if b >= 0:
		pos.append((a, b))
	else:
		neg.append((a, b))
for (a, b) in pos:
	if b != 0:
		g = gcd(a, b)
	else:
		g = a
	d[a // g, b // g][0] += 1
for (a, b) in neg:
	(a, b) = (-b, a)
	if b != 0:
		g = gcd(a, b)
	else:
		g = a
	d[a // g, b // g][1] += 1
ans = 1
for (p, n) in d.values():
	ans *= pow(2, p, MOD) + pow(2, n, MOD) - 1
	ans %= MOD
ans += zero - 1
ans %= MOD
print(ans)


from collections import defaultdict
import math
import sys
input = sys.stdin.readline

def select_num(a, b, mod=1000000007):
	sum = pow(2, a, mod) + pow(2, b, mod) - 1
	return sum % mod

def dict_count(d, a, b):
	this = a / b
	pair = b / a
	if not d.get(this, False):
		d[this] = {'num': 0, 'pair': pair}
	d[this]['num'] += 1

def main():
	MOD = 1000000007
	n = int(input())
	d = defaultdict(lambda : [0] * 2)
	zero = 0
	for i in range(n):
		(a, b) = map(int, input().split())
		if a == 0 or b == 0:
			if a == b == 0:
				n -= 1
				zero += 1
			elif a == 0:
				d[0][True] += 1
			elif b == 0:
				d[0][False] += 1
		else:
			gcd = math.gcd(a, b)
			a //= gcd
			b //= gcd
			if b < 0:
				(a, b) = (-a, -b)
			rot = False
			if a < 0:
				(b, a) = (-a, b)
				rot = True
			d[a, b][rot] += 1
	ans = 1
	for (k, v) in d.items():
		ans *= select_num(v[0], v[1], MOD)
		ans %= MOD
	ans += zero - 1
	ans %= MOD
	print(ans)

def __starting_point():
	main()
__starting_point()


from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint
sys.setrecursionlimit(10 ** 8)
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
n = inp()
z = 0
d = defaultdict(int)
for _ in range(n):
	(a, b) = inpl()
	if a == 0 and b == 0:
		z += 1
		continue
	if a == 0:
		b = 1
	if b == 0:
		a = 1
	if b < 0:
		(a, b) = (-a, -b)
	g = math.gcd(a, b)
	a //= g
	b //= g
	d[a, b] += 1
res = 1
seen = set()
for k in list(d):
	(a, b) = k
	if k in seen:
		continue
	if a < 0:
		(x, y) = (b, -a)
	else:
		(x, y) = (-b, a)
	if a == 0:
		(x, y) = (1, 0)
	if b == 0:
		(x, y) = (0, 1)
	res *= pow(2, d[a, b], mod) + pow(2, d[x, y], mod) - 1
	res %= mod
	seen.add(k)
	seen.add((x, y))
res += z - 1
print(res % mod)


from collections import defaultdict
(n, *L) = list(map(int, open(0).read().split()))
mod = 10 ** 9 + 7
d = defaultdict(lambda : [0, 0])
gcd = lambda x, y: x if y == 0 else gcd(y, x % y)
two = [1] * (n + 1)
for i in range(n):
	two[i + 1] = two[i] * 2 % mod
zero = 0
for (a, b) in zip(*[iter(L)] * 2):
	if a == b == 0:
		zero += 1
		continue
	if a == 0:
		d[0, 1][0] += 1
	elif b == 0:
		d[0, 1][1] += 1
	else:
		g = gcd(a, b)
		a //= g
		b //= g
		if a * b > 0:
			d[a, b][0] += 1
		else:
			d[abs(b), abs(a)][1] += 1
ans = 1
for ((_, _), (x, y)) in list(d.items()):
	ans *= (two[x] + two[y] - 1) % mod
	ans %= mod
print((ans + zero + mod - 1) % mod)


import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda : int(input())
mis = lambda : list(map(int, input().split()))
lmis = lambda : list(mis())
INF = float('inf')
N1097 = 10 ** 9 + 7

def meg(f, ok, ng):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if f(mid):
			ok = mid
		else:
			ng = mid
	return ok

def get_inv(n, modp):
	return pow(n, modp - 2, modp)

def factorials_list(n, modp):
	fs = [1]
	for i in range(1, n + 1):
		fs.append(fs[-1] * i % modp)
	return fs

def invs_list(n, fs, modp):
	invs = [get_inv(fs[-1], modp)]
	for i in range(n, 1 - 1, -1):
		invs.append(invs[-1] * i % modp)
	invs.reverse()
	return invs

def comb(n, k, modp):
	num = 1
	for i in range(n, n - k, -1):
		num = num * i % modp
	den = 1
	for i in range(2, k + 1):
		den = den * i % modp
	return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):
	return fs[n] * invs[n - k] * invs[k] % modp

class UnionFindEx:

	def __init__(self, size):
		self.roots = [-1] * size

	def getRootID(self, i):
		r = self.roots[i]
		if r < 0:
			return i
		else:
			r = self.getRootID(r)
			self.roots[i] = r
			return r

	def getGroupSize(self, i):
		return -self.roots[self.getRootID(i)]

	def connect(self, i, j):
		(r1, r2) = (self.getRootID(i), self.getRootID(j))
		if r1 == r2:
			return False
		if self.getGroupSize(r1) < self.getGroupSize(r2):
			(r1, r2) = (r2, r1)
		self.roots[r1] += self.roots[r2]
		self.roots[r2] = r1
		return True
Yes = 'Yes'
No = 'No'

def main():
	from fractions import Fraction
	N = ii()
	zero = 0
	d = defaultdict(lambda : [0, 0])
	for _ in range(N):
		(x, y) = mis()
		if x == y == 0:
			zero += 1
			continue
		if y < 0 or (y == 0 and x < 0):
			(x, y) = (-x, -y)
		g = gcd(x, y)
		x //= g
		y //= g
		if x <= 0:
			rot = True
			c = (y, -x)
		else:
			rot = False
			c = (x, y)
		d[c][rot] += 1
	N -= zero
	ans = 1
	for (q1, q2) in list(d.values()):
		ans *= pow(2, q1, N1097) - 1 + (pow(2, q2, N1097) - 1) + 1
		ans %= N1097
	ans -= 1
	ans %= N1097
	print(ans + zero)
main()


import sys
import math
mod = 1000000007
n = int(sys.stdin.readline().rstrip())
ab = {}
for i in range(n):
	(a, b) = map(int, sys.stdin.readline().rstrip().split())
	if a == 0 and b == 0:
		pass
	elif a == 0:
		b = 1
	else:
		gcd = math.gcd(a, b)
		a //= gcd
		b //= gcd
		if a < 0:
			a = -a
			b = -b
	ab.setdefault((a, b), 0)
	ab[a, b] += 1
ans = 0
pairs = []
s = set(ab.keys())
for i in ab.keys():
	a = i[0]
	b = i[1]
	if a == 0 and b == 0:
		ans = ab[0, 0]
		n -= ans
	elif (-b, a) in s:
		pairs.append([ab[a, b], ab[-b, a]])
select = 1
for pair in pairs:
	select *= pow(2, pair[0], mod) + pow(2, pair[1], mod) - 1
	n -= pair[0] + pair[1]
all_ans = pow(2, n, mod) * select % mod + ans - 1
all_ans %= mod
print(all_ans)


from collections import defaultdict
from math import gcd
N = int(input())
MOD = 10 ** 9 + 7
d = defaultdict(lambda : [0, 0])
zeros = 0
for _ in range(N):
	(x, y) = map(int, input().split())
	if x == 0 and y == 0:
		zeros += 1
	elif x == 0:
		d[0, 0][0] += 1
	elif y == 0:
		d[0, 0][1] += 1
	else:
		if y < 0:
			x = -x
			y = -y
		g = gcd(abs(x), abs(y))
		x //= g
		y //= g
		if x < 0:
			d[y, -x][0] += 1
		else:
			d[x, y][1] += 1
ans = 1
for (k, v) in d.items():
	ans *= pow(2, v[0], MOD) + pow(2, v[1], MOD) - 1
	ans %= MOD
ans = (ans + zeros - 1) % MOD
print(ans)


from sys import stdin, setrecursionlimit
from collections import defaultdict
from math import gcd
setrecursionlimit(10 ** 9)
INF = 1 << 60

def input():
	return stdin.readline().strip()
MOD = 1000000007
(N, *AB) = map(int, stdin.buffer.read().split())
d = defaultdict(int)
zeros = 0
for (a, b) in zip(AB[::2], AB[1::2]):
	if a == 0 and b == 0:
		zeros += 1
	else:
		g = gcd(a, b)
		a //= g
		b //= g
		if a < 0:
			a *= -1
			b *= -1
		if a == 0 and b == -1:
			b = 1
		d[a, b] += 1
ans = 1
free = 0
keys = sorted(d.keys())
for (a, b) in keys:
	n = d[a, b]
	if b > 0:
		if (b, -a) in d:
			m = d[b, -a]
			ans = ans * (pow(2, n, MOD) + pow(2, m, MOD) - 1) % MOD
		else:
			free += n
	elif (-b, a) not in d:
		free += n
ans = (ans * pow(2, free, MOD) + zeros - 1) % MOD
print(ans)


from math import gcd
from collections import Counter
mod = 10 ** 9 + 7
(N, *AB) = map(int, open(0).read().split())

def std(a, b):
	if a == 0:
		return (0, 1)
	g = gcd(a, b)
	(a, b) = (a // g, b // g)
	return (a, b) if a > 0 else (-a, -b)
C = Counter()
orig = 0
for (a, b) in zip(*[iter(AB)] * 2):
	if a == b == 0:
		orig += 1
	else:
		C[std(a, b)] += 1
ans = 1
cnt = 0
for ((a, b), v) in C.items():
	if b > 0:
		if (b, -a) in C:
			ans *= -1 + pow(2, v, mod) + pow(2, C[b, -a], mod)
			ans %= mod
		else:
			cnt += v
	elif (-b, a) not in C:
		cnt += v
ans *= pow(2, cnt, mod)
ans += orig - 1
print(ans % mod)


from math import gcd
n = int(input())
mod = 10 ** 9 + 7
d = dict()
zeros = 0
for _ in range(n):
	(a, b) = map(int, input().split())
	if not any((a, b)):
		zeros += 1
		continue
	if all((a, b)):
		g = gcd(a, b) * (a // abs(a))
	elif a:
		g = a
	else:
		g = b
	p = (a // g, b // g)
	d[p] = d.get(p, 0) + 1
ans = 1
done = set()
for ((a, b), v) in d.items():
	if (-b, a) in done or (b, -a) in done:
		continue
	done.add((a, b))
	w = d.get((-b, a), 0) + d.get((b, -a), 0)
	ans *= pow(2, v) + pow(2, w) - 1
	ans %= mod
print((ans + zeros - 1) % mod)


import numpy as np
dic = dict()
mod = 10 ** 9 + 7
p = 0

def reg(a, b):
	if a < 0 or (a == 0 and b < 0):
		(a, b) = (-a, -b)
	if b > 0:
		return (0, a, b)
	else:
		return (1, -b, a)
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		p += 1
		continue
	ab = np.gcd(a, b)
	(a, b) = (a // ab, b // ab)
	(idx, a, b) = reg(a, b)
	k = (a, b)
	if k not in dic.keys():
		dic[k] = [0, 0]
	dic[k][idx] += 1
not_p = 1
for k in dic.keys():
	(a, b) = k
	(pp, pm) = dic[k]
	not_p *= (pow(2, pp, mod) + pow(2, pm, mod) - 1) % mod
	not_p %= mod
print((p + not_p - 1) % mod)


from collections import deque
from math import gcd
import sys

def input():
	return sys.stdin.readline().rstrip()
MOD = 10 ** 9 + 7
n = int(input())
cnt = {}
zero_cnt = 0
ans = 1
for _ in range(n):
	(a, b) = map(int, input().split())
	if (a, b) == (0, 0):
		zero_cnt += 1
		continue
	g = gcd(abs(a), abs(b))
	if a == 0 or b == 0:
		g = max(abs(a), abs(b))
	a //= g
	b //= g
	rotate = 0
	while not (a > 0 and b >= 0):
		(a, b) = (-b, a)
		rotate += 1
	if (a, b) not in cnt:
		cnt[a, b] = [0, 0]
	cnt[a, b][rotate % 2] += 1
for key in cnt:
	(A, B) = cnt[key]
	ans *= 1 + pow(2, A, MOD) - 1 + pow(2, B, MOD) - 1
	ans %= MOD
ans += zero_cnt
ans -= 1
print(ans % MOD)


from collections import defaultdict
from math import gcd
MOD = 1000000007
N = int(input())
zeros = 0
bads = defaultdict(lambda : [0, 0])
for _ in range(N):
	(x, y) = map(int, input().split())
	if x == 0 and y == 0:
		zeros += 1
		continue
	if y < 0 or (y == 0 and x < 0):
		(x, y) = (-x, -y)
	g = gcd(x, y)
	(x, y) = (x // g, y // g)
	if x > 0:
		bads[x, y][0] += 1
	else:
		bads[y, -x][1] += 1
ans = 1
for (k, l) in bads.values():
	ans *= pow(2, k, MOD) - 1 + (pow(2, l, MOD) - 1) + 1
	ans %= MOD
print((ans + zeros - 1) % MOD)


def gcd(x, y):
	x = abs(x)
	y = abs(y)
	if x < y:
		(x, y) = (y, x)
	while y:
		(x, y) = (y, x % y)
	return x
N = int(input())
seen = dict()
zeroes = 0
MOD = 10 ** 9 + 7
for _ in range(N):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zeroes += 1
		continue
	if a < 0 or (a == 0 and b < 0):
		(a, b) = (-a, -b)
	if b <= 0:
		(a, b) = (-b, a)
		flip = 1
	else:
		flip = 0
	g = gcd(a, b)
	a //= g
	b //= g
	if (a, b) not in seen:
		seen[a, b] = [0, 0]
	seen[a, b][flip] += 1
out = 1
for v in seen:
	(a, b) = seen[v]
	out *= pow(2, a, MOD) + pow(2, b, MOD) - 1
	out %= MOD
out -= 1
out += zeroes
out %= MOD
print(out)


import sys
input = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(input())
d = {}
z = 0
from math import gcd
for i in range(n):
	(x, y) = map(int, input().split())
	if x == y == 0:
		z += 1
	else:
		f = gcd(x, y)
		x //= f
		y //= f
		if x < 0:
			x *= -1
			y *= -1
		if x == 0 and y < 0:
			y = -y
		if (x, y) not in d:
			d[x, y] = 1
		else:
			d[x, y] += 1
ans = 1
for (a, s) in d:
	if d[a, s] == 0:
		continue
	ng = 0
	if (s, -a) in d:
		ng += d[s, -a]
		d[s, -a] = 0
	if (-s, a) in d:
		ng += d[-s, a]
		d[-s, a] = 0
	ans *= (pow(2, d[a, s], mod) - 1 + pow(2, ng, mod) - 1 + 1) % mod
	ans %= mod
	d[a, s] = 0
print((ans + z - 1) % mod)


from math import gcd
import sys
input = lambda : sys.stdin.readline().strip()
n = int(input())
indet = 0
d = {}
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	if b < 0:
		a *= -1
		b *= -1
	if a == 0 and b == 0:
		indet += 1
		continue
	elif a == 0:
		p = (0, 1)
	elif b == 0:
		p = (-1, 0)
	else:
		g = gcd(a, b)
		p = (a // g, b // g)
	d[p] = d.get(p, 0) + 1
sizes = []
ignore = set()
for (p, size) in d.items():
	if p not in ignore:
		(a, b) = (-p[1], p[0])
		if b < 0:
			a *= -1
			b *= -1
		if (a, b) in d:
			ignore.add((a, b))
			sizes.append((size, d[a, b]))
		else:
			sizes.append((size, 0))
M = 10 ** 9 + 7
ans = 1
for (n1, n2) in sizes:
	ans *= pow(2, n1, M) + pow(2, n2, M) - 1
	ans %= M
print((indet + ans - 1) % M)


from math import gcd
from collections import defaultdict
MOD = 10 ** 9 + 7
n = int(input())
d = defaultdict(int)
tmp = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b == 0:
		tmp += 1
	else:
		if b < 0 or (b == 0 and a <= 0):
			a = -a
			b = -b
		g = gcd(a, b)
		a = a // g
		b = b // g
		d[a, b] += 1
		if a <= 0:
			d[b, -a]
		else:
			d[-b, a]
ans = 1
for (k, v) in d.items():
	(a, b) = k
	if a <= 0:
		continue
	c = d[-b, a]
	ans *= pow(2, v) + pow(2, c) - 1
	ans %= MOD
print((ans + tmp - 1) % MOD)


from math import gcd
from collections import defaultdict
n = int(input())
A = defaultdict(int)
AA = defaultdict(int)
B = []
C = []
X = []
mod = 10 ** 9 + 7
for i in range(n):
	(a, b) = map(int, input().split())
	if a < 0:
		a = a * -1
		b = b * -1
	if a * b > 0:
		l = a * b // gcd(a, b)
		A[str(l // b) + ':' + str(l // a)] += 1
	elif a * b < 0:
		l = a * -b // gcd(a, -b)
		AA[str(l // a) + ':' + str(l // -b)] += 1
	elif a == 0 and b == 0:
		X.append(i)
	elif a == 0:
		B.append(i)
	else:
		C.append(i)
E = set(list(A.keys()) + list(AA.keys()))
a = 1
for i in E:
	a = a * (2 ** A[i] + 2 ** AA[i] - 1) % mod
a = (a * (2 ** len(B) + 2 ** len(C) - 1) - 1) % mod
print((a + len(X)) % mod)


from math import gcd
mod = 1000000007
n = int(input())
zero = 0
bad = {}
for i in range(n):
	(x, y) = map(int, input().split())
	if x == 0 and y == 0:
		zero += 1
		continue
	g = gcd(x, y)
	x //= g
	y //= g
	if y < 0:
		(x, y) = (-x, -y)
	if y == 0 and x < 0:
		(x, y) = (-x, -y)
	is_rotate90 = x <= 0
	if is_rotate90:
		(x, y) = (y, -x)
	if not (x, y) in bad:
		bad[x, y] = [0, 0]
	bad[x, y][is_rotate90] += 1
ans = 1
for (x, y) in bad:
	(c1, c2) = bad[x, y]
	c3 = pow(2, c1, mod) - 1 + (pow(2, c2, mod) - 1) + 1
	ans *= c3
	ans %= mod
ans += zero - 1
ans = (ans + mod) % mod
print(ans)


from math import gcd
from collections import defaultdict
mod = 10 ** 9 + 7
(_, *S) = open(0)
mp = defaultdict(lambda : [0, 0])
O = 0
for s in S:
	(a, b) = map(int, s.split())
	if a == b == 0:
		O += 1
	else:
		g = gcd(a, b)
		a //= g
		b //= g
		if a < 0 or a == 0 < b:
			(a, b) = (-a, -b)
		f = 0
		if b < 0:
			(a, b, f) = (-b, a, 1)
		mp[a, b][f] += 1
ans = 1
for k in mp:
	(x, y) = mp[k]
	ans = ans * (pow(2, x, mod) + pow(2, y, mod) - 1) % mod
print((ans + O - 1) % mod)


from math import gcd
n = int(input())
MOD = 10 ** 9 + 7
cnt = {}
zero_cnt = 0
ans = 1
for i in range(n):
	(a, b) = map(int, input().split())
	if (a, b) == (0, 0):
		zero_cnt += 1
		continue
	g = gcd(abs(a), abs(b))
	a //= g
	b //= g
	rotate = 0
	while not (a >= 0 and b > 0):
		(a, b) = (-b, a)
		rotate += 1
	if (a, b) not in cnt:
		cnt[a, b] = [0, 0]
	cnt[a, b][rotate % 2] += 1
for key in cnt:
	(A, B) = cnt[key]
	ans *= 1 + pow(2, A, MOD) - 1 + pow(2, B, MOD) - 1
	ans %= MOD
ans += zero_cnt
ans -= 1
print(ans % MOD)


from collections import defaultdict
from math import gcd
MOD = 1000000007
N = int(input())
both_zeros_cnt = 0
bads = defaultdict(lambda : [0, 0])
for _ in range(N):
	(A, B) = map(int, input().split())
	if A == 0 and B == 0:
		both_zeros_cnt += 1
		continue
	if B < 0 or (B == 0 and A < 0):
		(A, B) = (-A, -B)
	g = gcd(A, B)
	(A, B) = (A // g, B // g)
	if A > 0:
		bads[A, B][0] += 1
	else:
		bads[B, -A][1] += 1
NMAX = 2 * 10 ** 5 + 1
pow2 = [1] * (NMAX + 1)
for i in range(1, NMAX + 1):
	pow2[i] = pow2[i - 1] * 2 % MOD
ans = 1
for (k, l) in bads.values():
	ans *= pow2[k] + pow2[l] - 1
	ans %= MOD
print((ans + both_zeros_cnt - 1) % MOD)


from math import gcd
from collections import defaultdict

def sign(x):
	if x < 0:
		return -1
	if x > 0:
		return +1
	return 0

def power(a, b, m):
	res = 1
	base = a
	while b:
		if b & 1:
			res = res * base % m
		base = base * base % m
		b = b >> 1
	return res
N = int(input())
M = 1000000007
cnt = defaultdict(int)
case00 = 0
for _ in range(N):
	(a, b) = list(map(int, input().split()))
	if a == 0 and b == 0:
		case00 += 1
		continue
	s = sign(a) * sign(b)
	(a, b) = (abs(a), abs(b))
	g = gcd(a, b)
	(a, b) = (a // g, b // g)
	cnt[s, a, b] += 1
ans = 1
vis = set()
for (s, a, b) in list(cnt.keys()):
	if (s, a, b) in vis:
		continue
	if (-s, b, a) in cnt:
		mul = 1
		mul += power(2, cnt[s, a, b], M) - 1
		mul += power(2, cnt[-s, b, a], M) - 1
		ans = ans * (mul % M) % M
		vis.add((-s, b, a))
	else:
		ans = ans * power(2, cnt[s, a, b], M) % M
ans = (ans - 1 + M) % M
ans = (ans + case00) % M
print(ans)


from math import gcd
mod = 10 ** 9 + 7
n = int(input())
iwashi = dict()
origin_iwashi = 0
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == b == 0:
		origin_iwashi += 1
	elif a == 0:
		if (1, 0) in iwashi:
			iwashi[1, 0][1] += 1
		else:
			iwashi[1, 0] = [0, 1]
	elif b == 0:
		if (1, 0) in iwashi:
			iwashi[1, 0][0] += 1
		else:
			iwashi[1, 0] = [1, 0]
	else:
		if b < 0:
			(a, b) = (-a, -b)
		g = gcd(a, b)
		a //= g
		b //= g
		if a > 0:
			if (a, b) in iwashi:
				iwashi[a, b][0] += 1
			else:
				iwashi[a, b] = [1, 0]
		elif (b, -a) in iwashi:
			iwashi[b, -a][1] += 1
		else:
			iwashi[b, -a] = [0, 1]
count = 1
for (i, j) in iwashi.values():
	tmp = pow(2, i, mod) + pow(2, j, mod) - 1
	count = count * tmp % mod
count = (count + origin_iwashi - 1) % mod
print(count)


from math import gcd
from collections import defaultdict
N = int(input())
d = {}
MOD = 10 ** 9 + 7
zall = 0
for _ in range(N):
	(A, B) = list(map(int, input().split()))
	if A == 0 and B == 0:
		zall += 1
	else:
		if A and B:
			if A < 0 and B < 0:
				A *= -1
				B *= -1
			elif A < 0 and B > 0:
				A *= -1
				B *= -1
			g = gcd(A, B)
			A //= g
			B //= g
		elif A == 0:
			B = 1
		elif B == 0:
			A = 1
		if (A, B) in d:
			d[A, B] += 1
		else:
			d[A, B] = 1
ans = 1
used = defaultdict(int)
for ((i, j), v) in list(d.items()):
	if used[i, j]:
		continue
	used[i, j] = 1
	buf = 0
	if j > 0:
		if (j, -i) in d:
			used[j, -i] = 1
			buf = d[j, -i]
		else:
			buf = 0
	elif (-j, i) in d:
		used[-j, i] = 1
		buf = d[-j, i]
	else:
		buf = 0
	ans *= pow(2, buf, MOD) + pow(2, v, MOD) - 1
	ans %= MOD
print((ans + zall - 1) % MOD)


import collections

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
mod = 10 ** 9 + 7
n = int(input())
dic = collections.defaultdict(int)
cnt = 0
for _ in range(n):
	(a, b) = map(int, input().split())
	if a != 0 and b != 0:
		g = gcd(abs(a), abs(b))
		if a * b > 0:
			dic[abs(a) // g, abs(b) // g] += 1
		else:
			dic[-abs(a) // g, abs(b) // g] += 1
	elif a == 0 and b == 0:
		cnt += 1
	elif a == 0:
		dic[0, 1] += 1
	elif b == 0:
		dic[1, 0] += 1
ans = 1
s = set()
for (a, b) in dic.keys():
	if (a, b) in s:
		continue
	s.add((a, b))
	if a > 0:
		s.add((-b, a))
		cnt1 = dic[a, b]
		if (-b, a) in dic:
			cnt2 = dic[-b, a]
		else:
			cnt2 = 0
		ans *= (pow(2, cnt1, mod) + pow(2, cnt2, mod) - 1) % mod
		ans %= mod
	else:
		s.add((b, -a))
		cnt1 = dic[a, b]
		if (b, -a) in dic:
			cnt2 = dic[b, -a]
		else:
			cnt2 = 0
		ans *= (pow(2, cnt1, mod) + pow(2, cnt2, mod) - 1) % mod
		ans %= mod
print((ans + cnt - 1) % mod)


from collections import defaultdict
MOD = 10 ** 9 + 7
from math import gcd
n = int(input())
ans = 1
C = defaultdict(int)
z = 0
r = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		r += 1
	elif b == 0:
		z += 1
	elif a == 0:
		C[0] += 1
	else:
		g = gcd(abs(a), abs(b))
		a //= g
		b //= g
		if a < 0:
			(a, b) = (-a, -b)
		C[a, b] += 1
D = tuple(C.items())
used = {0}
for (c, v) in D:
	if c in used:
		continue
	(a, b) = c
	if b > 0:
		(d, e) = (b, -a)
	else:
		(d, e) = (-b, a)
	ans *= pow(2, v, MOD) + pow(2, C[d, e], MOD) - 1
	ans %= MOD
	used.add((d, e))
ans *= pow(2, C[0], MOD) + pow(2, z, MOD) - 1
ans += r
ans -= 1
ans %= MOD
print(ans)


import collections
from math import gcd
import sys
input = sys.stdin.readline

def main():
	n = int(input())
	c = collections.Counter()
	mod = 10 ** 9 + 7
	for _ in range(n):
		(a, b) = list(map(int, input().split()))
		g = abs(gcd(a, b))
		if g == 0:
			g = 1
		a //= g
		b //= g
		c[a, b] += 1
	ans = 1
	s = set()
	for (i, j) in c:
		if (i, j) == (0, 0):
			continue
		if (i, j) not in s:
			s.add((i, j))
			s.add((-i, -j))
			s.add((-j, i))
			s.add((j, -i))
			ans *= (pow(2, c[i, j] + c[-i, -j], mod) + pow(2, c[j, -i] + c[-j, i], mod) - 1) % mod
	print((ans - 1 + c[0, 0]) % mod)

def __starting_point():
	main()
__starting_point()


N = int(input())
zero = 0
r_zero = 0
l_zero = 0
mod = 1000000007
from collections import defaultdict
from math import gcd
dic = defaultdict(int)
for i in range(N):
	(A, B) = list(map(int, input().split()))
	if A == 0 and B == 0:
		zero += 1
		continue
	elif A == 0:
		r_zero += 1
	elif B == 0:
		l_zero += 1
	else:
		g = gcd(A, B)
		A //= g
		B //= g
		if A < 0:
			(A, B) = (-A, -B)
		dic[A, B] += 1
dickey = list(dic.keys())
s = set(dickey)
nopair = N - zero - r_zero - l_zero
ans = pow(2, r_zero, mod) + pow(2, l_zero, mod) - 1
for (a, b) in dickey:
	if a * b > 0 and (b, -a) in s:
		ans *= (pow(2, dic[a, b], mod) + pow(2, dic[b, -a], mod) - 1) % mod
		nopair -= dic[a, b] + dic[b, -a]
ans *= pow(2, nopair, mod)
print((ans - 1 + zero) % mod)


import math
n = int(input())
D = {}
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		key = (0, 0)
	elif a == 0:
		key = (0, 1)
	elif b == 0:
		key = (1, 0)
	else:
		if a < 0:
			a = -a
			b = -b
		g = math.gcd(a, abs(b))
		key = (a // g, b // g)
	if key not in D:
		D[key] = 0
	D[key] += 1
mod = 10 ** 9 + 7
ans = 1
zz = 0
for (k1, v1) in D.items():
	if k1 == (0, 0):
		zz += v1
		continue
	if v1 == 0:
		continue
	if k1[1] > 0:
		k2 = (k1[1], -k1[0])
	else:
		k2 = (-k1[1], k1[0])
	if k2 not in D:
		ans = ans * pow(2, v1, mod) % mod
	else:
		v2 = D[k2]
		m = (pow(2, v1, mod) + pow(2, v2, mod) - 1) % mod
		ans = ans * m % mod
		D[k2] = 0
print((ans + zz - 1) % mod)


def f():
	return [0, 0]
from collections import defaultdict
import math
mod = 1000000007
n = int(input())
dic = defaultdict(f)
x = []
(zerozero, azero, bzero) = (0, 0, 0)
two = [1]
for i in range(n):
	two.append(two[-1] * 2 % mod)
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zerozero += 1
	elif a == 0:
		azero += 1
	elif b == 0:
		bzero += 1
	else:
		k = math.gcd(a, b)
		a //= k
		b //= k
		if a < 0:
			a *= -1
			b *= -1
		if a * b > 0:
			dic[a, b][0] += 1
		else:
			dic[-b, a][1] += 1
for (a, b) in dic:
	x.append(dic[a, b])
x.append([azero, bzero])
ans = 1
for [p, q] in x:
	ans *= two[p] + two[q] - 1
	ans %= mod
print((ans - 1 + zerozero) % mod)


from math import gcd
(_, *e) = [[*list(map(int, t.split()))] for t in open(0)]
ans = 1
mod = 10 ** 9 + 7
slope_dict = {}
zeros = 0
for (x, y) in e:
	if x == y == 0:
		zeros += 1
	else:
		d = gcd(x, y)
		x //= d
		y //= d
		if x < 0 or x == 0 < y:
			(x, y) = (-x, -y)
		s = 0
		if y < 0:
			(x, y, s) = (-y, x, 1)
		if (x, y) not in slope_dict:
			slope_dict[x, y] = [0, 0]
		slope_dict[x, y][s] += 1
for k in slope_dict:
	ans = ans * (pow(2, slope_dict[k][0], mod) + pow(2, slope_dict[k][1], mod) - 1) % mod
print((ans + zeros - 1) % mod)


import sys
input = sys.stdin.readline
import math
mod = 10 ** 9 + 7
N = int(input())
As = {}
Empty = 0
for _ in range(N):
	(x, y) = map(int, input().split())
	g = math.gcd(x, y)
	if g == 0:
		Empty += 1
		continue
	(x, y) = (x // g, y // g)
	if y < 0 or (y == 0 and x < 0):
		y = -y
		x = -x
	if (x, y) in As:
		As[x, y] += 1
	else:
		As[x, y] = 1
ans = 1
for ((x, y), num) in As.items():
	if (-y, x) in As:
		ans = ans * (pow(2, num, mod) + pow(2, As[-y, x], mod) - 1) % mod
	elif not (y, -x) in As:
		ans = ans * pow(2, num, mod) % mod
print((ans - 1 + Empty) % mod)


import math
N = int(input())
MOD = 10 ** 9 + 7
fish = {}
ans = 1
a = 0
b = 0
w = 0
for i in range(N):
	(A, B) = map(int, input().split())
	if A == 0 and B == 0:
		w += 1
	elif A == 0:
		a += 1
	elif B == 0:
		b += 1
	else:
		c = math.gcd(A, B)
		A = A // c
		B = B // c
		if B < 0:
			(A, B) = (-A, -B)
		k = (A, B)
		if not k in fish:
			fish[k] = 0
		fish[k] += 1
group = set()
for ((p, q), v) in fish.items():
	(invp, invq) = (-q, p)
	if invq < 0:
		(invp, invq) = (-invp, -invq)
	if not (invp, invq) in group:
		group.add((p, q))
for (p, q) in group:
	(invp, invq) = (-q, p)
	if invq < 0:
		(invp, invq) = (-invp, -invq)
	t = 2 ** fish[p, q]
	if (invp, invq) in fish:
		t += 2 ** fish[invp, invq] - 1
	ans = ans * t % MOD
ans *= 2 ** a + 2 ** b - 1
ans = ans + w - 1
print(ans % MOD)


from collections import defaultdict
from math import gcd
(N, *L) = map(int, open(0).read().split())
dic = defaultdict(int)
ans = 0
MOD = 10 ** 9 + 7
S = set()
for (a, b) in zip(*[iter(L)] * 2):
	if a == 0 and b == 0:
		ans += 1
		continue
	g = gcd(a, b)
	if b > 0:
		dic[a // g, b // g] += 1
		S.add((a // g, b // g))
	elif b < 0:
		dic[-a // g, -b // g] += 1
		S.add((-a // g, -b // g))
	else:
		dic[1, 0] += 1
		S.add((1, 0))
m = 1
for (a, b) in S:
	if a <= 0:
		if dic[b, -a] == 0:
			m *= pow(2, dic[a, b], MOD)
			m %= MOD
			continue
	else:
		if dic[-b, a] == 0:
			m *= pow(2, dic[a, b], MOD)
			m %= MOD
			continue
		c = pow(2, dic[a, b], MOD) + pow(2, dic[-b, a], MOD) - 1
		m *= c
		m %= MOD
ans = (m - 1 + ans) % MOD
print(ans)


from math import gcd
N = int(input())
mod = 1000000007
ans = 1
P = dict()
M = dict()
zero = 0
zero1 = 0
zero2 = 0
for i in range(N):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zero += 1
	elif a == 0 and b != 0:
		zero1 += 1
	elif a != 0 and b == 0:
		zero2 += 1
	elif a > 0 and b < 0 or (a < 0 and b > 0):
		GCD = gcd(abs(a), abs(b))
		a = abs(a) // GCD
		b = abs(b) // GCD
		s = str(a) + '/' + str(b)
		P[s] = P.get(s, 0) + 1
	else:
		GCD = gcd(abs(a), abs(b))
		a = abs(a) // GCD
		b = abs(b) // GCD
		s = str(b) + '/' + str(a)
		M[s] = M.get(s, 0) + 1
P['0/0'] = zero1
M['0/0'] = zero2
for (v, cnt_p) in P.items():
	if v in M:
		cnt_m = M[v]
		ans *= 2 ** cnt_p + 2 ** cnt_m - 1
		M.pop(v)
	else:
		ans *= 2 ** cnt_p
	ans %= mod
for (v, cnt_m) in M.items():
	ans *= 2 ** cnt_m
	ans %= mod
ans -= 1
ans += zero
ans %= mod
print(ans)


from math import gcd
MOD = 10 ** 9 + 7
N = int(input())
d = {}
zero = 0
for _ in range(N):
	(a, b) = list(map(int, input().split()))
	if a == b == 0:
		zero += 1
		continue
	if b < 0:
		b = -b
		a = -a
	g = gcd(a, b)
	b //= g
	a //= g
	if b == 0 and a == -1:
		a = 1
	if a > 0:
		if (a, b) in d:
			d[a, b][0] += 1
		else:
			d[a, b] = [1, 0]
	elif (b, -a) in d:
		d[b, -a][1] += 1
	else:
		d[b, -a] = [0, 1]
ans = 1
for ((a, b), (k, l)) in list(d.items()):
	ans *= pow(2, k, MOD) - 1 + pow(2, l, MOD) - 1 + 1
	ans %= MOD
ans -= 1
ans += zero
ans %= MOD
print(ans)


from sys import stdin
from collections import defaultdict
from math import gcd

def main():
	MOD = 1000000007
	(N, *AB) = map(int, stdin.buffer.read().split())
	d = defaultdict(int)
	n_zeros = 0
	for (a, b) in zip(AB[::2], AB[1::2]):
		if a == 0 and b == 0:
			n_zeros += 1
			continue
		g = gcd(a, b)
		(a, b) = (a // g, b // g)
		if a * b > 0 or b == 0:
			c = (abs(a), abs(b))
		else:
			c = (-abs(a), -abs(b))
		d[c] += 1
	ans = 1
	n_not_paired = 0
	for (ab, n) in d.items():
		ab_pair = (-ab[1], -ab[0])
		if ab_pair in d:
			if ab[0] > 0:
				m = d[ab_pair]
				ans = ans * (pow(2, n, MOD) + pow(2, m, MOD) - 1) % MOD
		else:
			n_not_paired += n
	ans = (ans * pow(2, n_not_paired, MOD) + n_zeros - 1) % MOD
	print(ans)
main()


import sys
input = sys.stdin.readline
from collections import defaultdict
from fractions import Fraction
from bisect import bisect_left, bisect_right

def read():
	N = int(input().strip())
	AB = []
	ZAB = []
	M = 0
	ZM = 0
	for i in range(N):
		(a, b) = map(int, input().strip().split())
		if a != 0 or b != 0:
			AB.append((a, b))
			M += 1
	return (N, M, AB)

def solve(N, M, AB, MOD=1000000007):
	D = defaultdict(int)
	INVD = defaultdict(int)
	keys = set()
	for (a, b) in AB:
		if a == 0:
			D['0'] += 1
			keys.add('0')
		elif b == 0:
			INVD['0'] += 1
			keys.add('0')
		else:
			f = Fraction(a, b)
			if f > 0:
				key = str(f)
				D[key] += 1
				keys.add(key)
			else:
				key = str(-1 / f)
				INVD[key] += 1
				keys.add(key)
	ans = 1
	for key in keys:
		g1 = pow(2, D[key], MOD) - 1
		g2 = pow(2, INVD[key], MOD) - 1
		g3 = 1
		ans *= g1 + g2 + g3
		ans %= MOD
	ans -= 1
	ans %= MOD
	ans += N - M
	ans %= MOD
	return ans

def __starting_point():
	inputs = read()
	outputs = solve(*inputs)
	if outputs is not None:
		print('%s' % str(outputs))
__starting_point()


import math
n = int(input())
mod = 10 ** 9 + 7
data = {}
zero_zero = 0
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a == 0 and b == 0:
		zero_zero += 1
		continue
	gcd = math.gcd(a, b)
	(a, b) = (a // gcd, b // gcd)
	if a < 0:
		(a, b) = (-a, -b)
	if a == 0:
		(a, b) = (0, 1)
	elif b == 0:
		(a, b) = (1, 0)
	if b <= 0:
		if (-b, a) in data:
			data[-b, a][1] += 1
		else:
			data[-b, a] = [0, 1]
	elif b > 0:
		if (a, b) in data:
			data[a, b][0] += 1
		else:
			data[a, b] = [1, 0]
power_2 = [1]
for i in range(1, 2 * 10 ** 5 + 100):
	power_2.append(power_2[i - 1] * 2 % mod)
ans = 1
for ((a, b), (l, m)) in list(data.items()):
	ans *= (power_2[l] + power_2[m] - 1) % mod
ans = ans - 1
ans += zero_zero
print(ans % mod)


mod = 10 ** 9 + 7

def regularize(a, b):
	if a < 0 or (a == 0 and b < 0):
		(a, b) = (-a, -b)
	if b > 0:
		return (0, a, b)
	else:
		return (1, -b, a)

def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)
n = int(input())
edict = dict()
zero_num = 0
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zero_num += 1
		continue
	ab_gcd = gcd(a, b)
	(a, b) = (a // ab_gcd, b // ab_gcd)
	(index, a, b) = regularize(a, b)
	key = (a, b)
	if key not in edict.keys():
		edict[key] = [0, 0]
	edict[key][index] += 1
not_zeros = 1
for key in edict.keys():
	(a, b) = key
	(pp, pm) = edict[key]
	not_zeros *= (pow(2, pp, mod) + pow(2, pm, mod) - 1) % mod
	not_zeros %= mod
print((zero_num + not_zeros - 1) % mod)


def resolve():
	import math
	from math import gcd
	MOD = 10 ** 9 + 7
	n = int(input())
	zero = 0
	cnt = {}
	for i in range(n):
		(a, b) = map(int, input().split())
		if a == 0 and b == 0:
			zero += 1
			continue
		g = gcd(a, b)
		a //= g
		b //= g
		if b < 0:
			a *= -1
			b *= -1
		if b == 0 and a < 0:
			a *= -1
		if a <= 0:
			(a, b) = (b, -a)
			if (a, b) in cnt:
				cnt[a, b][0] += 1
			else:
				cnt[a, b] = [1, 0]
		elif (a, b) in cnt:
			cnt[a, b][1] += 1
		else:
			cnt[a, b] = [0, 1]
	ans = 1
	for (i, v) in cnt.items():
		ans *= pow(2, v[0], MOD) + pow(2, v[1], MOD) - 1
		ans %= MOD
	print((zero - 1 + ans) % MOD)
resolve()


from math import gcd
mod = 10 ** 9 + 7
N = int(input())
dic = {}
zero = 0
for _ in range(N):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zero += 1
		continue
	elif a == 0:
		key = (0, 1)
	elif b == 0:
		key = (1, 0)
	else:
		if a < 0:
			a = -a
			b = -b
		g = gcd(a, abs(b))
		key = (a // g, b // g)
	if key not in dic:
		dic[key] = 0
	dic[key] += 1
ans = 1
for (k1, v1) in dic.items():
	if v1 == 0:
		continue
	if k1[1] > 0:
		k2 = (k1[1], -k1[0])
	else:
		k2 = (-k1[1], k1[0])
	if k2 not in dic:
		ans *= 2 ** v1
		ans %= mod
	else:
		ans *= (2 ** v1 - 1) % mod + (2 ** dic[k2] - 1) % mod + 1
		ans %= mod
		dic[k2] = 0
ans = (ans + zero - 1) % mod
print(ans)


N = int(input())
AB = [list(map(int, input().split())) for i in range(N)]
from collections import defaultdict
d = defaultdict(int)
d2 = defaultdict(int)
a0 = 0
b0 = 0
c0 = 0
from math import gcd
for (a, b) in AB:
	if a == b == 0:
		c0 += 1
	elif a == 0:
		a0 += 1
	elif b == 0:
		b0 += 1
	else:
		if a < 0:
			(a, b) = (-a, -b)
		g = gcd(a, b)
		(a, b) = (a // g, b // g)
		if b > 0:
			d[a, b] += 1
		else:
			d2[-b, a] += 1
m = 10 ** 9 + 7
a = 1
for (k, v) in d.items():
	if k in d2:
		a = a * (pow(2, v, m) + pow(2, d2[k], m) - 1) % m
	else:
		a = a * pow(2, v, m) % m
for (k, v) in d2.items():
	if k not in d:
		a = a * pow(2, v, m) % m
print((a * (pow(2, a0, m) + pow(2, b0, m) - 1) - 1 + c0) % m)


import sys, bisect, collections, math
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 1000000007

def I():
	return int(input())

def F():
	return float(input())

def S():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

def LS():
	return input().split()

def resolve():
	N = I()
	AB = [LI() for _ in range(N)]

	def normalize(AB):
		A = AB[0]
		B = AB[1]
		if A == B == 0:
			return (0, 0)
		elif A == 0:
			return (0, 1)
		elif B == 0:
			return (1, 0)
		else:
			gcd = math.gcd(A, B)
			A //= gcd
			B //= gcd
			if A < 0:
				(A, B) = (-A, -B)
			return (A, B)

	def orthogonal(AB):
		A = AB[0]
		B = AB[1]
		if B > 0:
			return (B, -A)
		else:
			return (-B, A)
	AB_n = [normalize(i) for i in AB]
	counter = collections.Counter(AB_n)
	used = set()
	ans = 1
	for (A, B) in AB_n:
		if not (A, B) in used:
			if (A, B) != (0, 0):
				ans *= pow(2, counter[A, B], MOD) + pow(2, counter[orthogonal((A, B))], MOD) - 1
				ans %= MOD
				used.add((A, B))
				used.add(orthogonal((A, B)))
	ans -= 1
	ans += counter[0, 0]
	ans %= MOD
	print(ans)

def __starting_point():
	resolve()
__starting_point()


import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict
MOD = 10 ** 9 + 7
N = int(input())
dic = defaultdict(int)
zero = 0
for i in range(N):
	(a, b) = map(int, input().split())
	if b < 0:
		a = -a
		b = -b
	if a == 0 and b == 0:
		zero += 1
		continue
	elif a == 0:
		b = 1
	elif b == 0:
		a = 1
	g = math.gcd(a, b)
	a //= g
	b //= g
	dic[a, b] += 1
done = set()
ans = 1
for (a, b) in dic:
	k = (a, b)
	if k in done:
		continue
	(c, d) = (-b, a)
	if d <= 0:
		c = -c
		d = -d
	rk = (c, d)
	done.add(k)
	done.add(rk)
	c = pow(2, dic[k], MOD) - 1
	if rk in dic:
		c += pow(2, dic[rk], MOD) - 1
	c += 1
	ans *= c
	ans %= MOD
print((ans + zero - 1) % MOD)


from math import gcd
n = int(input())
mod = 1000000007
z = 0
d = {}
for _ in range(n):
	(a, b) = map(int, input().split())
	if not any((a, b)):
		z += 1
		continue
	if a == 0:
		d[0, 1] = d.get((0, 1), 0) + 1
		continue
	if b == 0:
		d[1, 0] = d.get((1, 0), 0) + 1
		continue
	g = gcd(a, b)
	s = a // abs(a)
	(a, b) = (a // g * s, b // g * s)
	d[a, b] = d.get((a, b), 0) + 1
done = set()
ans = 1
for ((a, b), v) in d.items():
	if (a, b) in done:
		continue
	done.add((a, b))
	done.add((-b, a))
	done.add((b, -a))
	w = d.get((-b, a), 0) + d.get((b, -a), 0)
	ans *= pow(2, v, mod) + pow(2, w, mod) - 1
	ans %= mod
ans = (ans + z - 1 + mod) % mod
print(ans)


from collections import defaultdict
from math import gcd
MOD = 10 ** 9 + 7
n = int(input())
L = []
for i in range(n):
	l = list(map(int, input().split()))
	L.append(l)

def kikaku(a, b):
	g = gcd(a, b)
	a //= g
	b //= g
	if a < 0:
		return (-a, -b)
	return (a, b)
Dpos = defaultdict(int)
Dneg = defaultdict(int)
zerozero = 0
azero = 0
bzero = 0
for l in L:
	a = l[0]
	b = l[1]
	if a == b == 0:
		zerozero += 1
		continue
	if a == 0:
		azero += 1
		continue
	if b == 0:
		bzero += 1
		continue
	(a, b) = kikaku(a, b)
	if b > 0:
		Dpos[a, b] += 1
	else:
		Dneg[a, -b] += 1
		Dpos[-b, a] += 0
r = 1
for (k, v) in list(Dpos.items()):
	(a, b) = k
	j = Dneg[b, a]
	r *= pow(2, v, MOD) + pow(2, j, MOD) - 1
	r %= MOD
r *= pow(2, azero, MOD) + pow(2, bzero, MOD) - 1
r %= MOD
r -= 1
r %= MOD
ans = r + zerozero
ans %= MOD
print(ans)


import sys
from math import gcd
from collections import Counter
read = sys.stdin.read
readline = sys.stdin.readline
(N, *AB) = list(map(int, read().split()))
mod = 10 ** 9 + 7
ab = []
zero = 0
for (A, B) in zip(*[iter(AB)] * 2):
	if A == 0 and B == 0:
		zero += 1
		continue
	if A == 0:
		B = -1
	elif B == 0:
		A = 1
	else:
		g = gcd(A, B)
		A //= g
		B //= g
	if A < 0:
		(A, B) = (-A, -B)
	ab.append((A, B))
cnt = Counter(ab)
answer = 1
checked = set()
ok = 0
for ((i, j), n) in list(cnt.items()):
	if (i, j) in checked:
		continue
	if j < 0:
		(c, d) = (-j, i)
	else:
		(c, d) = (j, -i)
	if (c, d) in cnt:
		m = cnt[c, d]
		answer = answer * (pow(2, n, mod) + pow(2, m, mod) - 1) % mod
		checked.add((c, d))
	else:
		ok += n
answer *= pow(2, ok, mod)
answer -= 1
answer += zero
answer %= mod
print(answer)


from math import gcd
n = int(input())
mod = 10 ** 9 + 7
z = 0
za = 0
zb = 0
d = {}
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		z += 1
	elif a == 0:
		za += 1
	elif b == 0:
		zb += 1
	else:
		g = gcd(a, b)
		a //= g
		b //= g
		if a < 0:
			(a, b) = (-a, -b)
		if b > 0:
			if (a, b) in d:
				d[a, b][0] += 1
			else:
				d[a, b] = [1, 0]
		elif (-b, a) in d:
			d[-b, a][1] += 1
		else:
			d[-b, a] = [0, 1]
ans = 1
for key in d:
	ans *= (pow(2, d[key][0], mod) + pow(2, d[key][1], mod) - 1) % mod
	ans %= mod
ans *= (pow(2, za, mod) + pow(2, zb, mod) - 1) % mod
ans %= mod
print((ans + z - 1) % mod)


import math
N = int(input())
A = {}
mod = 10 ** 9 + 7
(AZ, BZ, ZZ) = (0, 0, 0)
for i in range(N):
	(a, b) = map(int, input().split())
	if a == b and a == 0:
		ZZ += 1
	elif a == 0:
		AZ += 1
		if (0, -1) not in A:
			A[0, -1] = 1
		else:
			A[0, -1] += 1
	elif b == 0:
		BZ += 1
		if (1, 0) not in A:
			A[1, 0] = 1
		else:
			A[1, 0] += 1
	else:
		if a < 0:
			a *= -1
			b *= -1
		d = math.gcd(abs(a), abs(b))
		a //= d
		b //= d
		if (a, b) not in A:
			A[a, b] = 1
		else:
			A[a, b] += 1
c = 0
D = []
for (x, y) in A:
	if (y, -x) in A:
		D.append((A[x, y], A[y, -x]))
		c += A[x, y] + A[y, -x]
n = N - c - ZZ
p = pow(2, n, mod)
ans = p
for (a, b) in D:
	f = pow(2, a + b, mod) - (pow(2, a, mod) - 1) * (pow(2, b, mod) - 1)
	ans *= f
ans -= 1
print((ans + ZZ) % mod)


n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
from collections import defaultdict
from math import gcd
d = defaultdict(int)
for (a, b) in ab:
	if a == 0 and b == 0:
		d[0, 0] += 1
	elif a == 0:
		d[1, 0] += 1
	elif b == 0:
		d[0, 1] += 1
	else:
		if a < 0:
			a *= -1
			b *= -1
		g = gcd(a, b)
		d[a // g, b // g] += 1
mod = pow(10, 9) + 7
ans = 1
keys = list(d.keys())
for k in keys:
	if k == (0, 0):
		continue
	else:
		(a, b) = k
		x = b if b > 0 else -b
		y = -a if b > 0 else a
		k0 = tuple([x, y])
		if k0 in d:
			ans *= pow(2, d[k], mod) - 1 + pow(2, d[k0], mod) - 1 + 1
			ans %= mod
			d[k] = 0
			d[k0] = 0
		else:
			ans *= pow(2, d[a, b], mod)
			ans %= mod
ans += d[0, 0]
ans -= 1
print(ans % mod)


from math import gcd
n = int(input())
ab = {}
ans = 0
mod = 10 ** 9 + 7

def go(a, b):
	if a == 0 and b == 0:
		return (0, 0)
	elif a == 0:
		return (0, 1)
	elif b == 0:
		return (1, 0)
	c = gcd(a, b)
	(a, b) = (a // c, b // c)
	if a < 0:
		a *= -1
		b *= -1
	return (a, b)

def la(a, b):
	r = max((a, b), go(b, -a))
	if r == (a, b):
		return (r, 0)
	else:
		return (r, 1)
zero = 0
for i in range(n):
	(a, b) = [int(i) for i in input().split()]
	(a, b) = go(a, b)
	if a == b == 0:
		zero += 1
	else:
		(l, ind) = la(a, b)
		if l in ab:
			ab[l][ind] += 1
		else:
			ab[l] = [0, 0]
			ab[l][ind] += 1
ans = 1
for i in ab:
	ans *= pow(2, ab[i][0], mod) + pow(2, ab[i][1], mod) - 1
	ans %= mod
print((ans + zero - 1) % mod)


import sys
from math import gcd
(N, *AB) = map(int, sys.stdin.buffer.read().split())
dict_F = {}
count_0 = 0

def insert(A, B, s):
	if (A, B) not in dict_F.keys():
		dict_F[A, B] = [0, 0]
	dict_F[A, B][s] += 1

def make_power2(N):
	result = 1
	list_result = [1]
	for _ in range(N):
		result = 2 * result % mod
		list_result.append(result)
	return list_result
for i in range(N):
	(A, B) = (AB[2 * i], AB[2 * i + 1])
	if A == 0 and B == 0:
		count_0 += 1
		continue
	g = gcd(A, B)
	A //= g
	B //= g
	if A >= 0 and B > 0:
		insert(A, B, 0)
	elif A > 0 and B <= 0:
		insert(-B, A, 1)
	elif A <= 0 and B < 0:
		insert(-A, -B, 0)
	elif A < 0 and B >= 0:
		insert(B, -A, 1)
mod = 1000000007
power2 = make_power2(N)
answer = 1
for (A, B) in dict_F.values():
	answer = answer * (power2[A] + power2[B] - 1) % mod
answer = (answer + count_0 - 1) % mod
print(answer)


from collections import Counter
from math import gcd
n = int(input())
counter = Counter()
for i in range(n):
	(a, b) = map(int, input().split())
	if b < 0:
		(a, b) = (-a, -b)
	elif b == 0:
		a = abs(a)
	if not a == b == 0:
		g = gcd(a, b)
		a //= g
		b //= g
	counter[a, b] += 1
modulus = 1000000007
vs = set(counter)
vs.update(((b, -a) for (a, b) in counter if a <= 0))
vs = [(a, b) for (a, b) in vs if a > 0]
ncomb = 1
for (a, b) in vs:
	n1 = counter[a, b]
	n2 = counter[-b, a]
	m = pow(2, n1, modulus) + pow(2, n2, modulus) - 1
	ncomb = ncomb * m % modulus
ncomb -= 1
ncomb += counter[0, 0]
print(ncomb % modulus)


from math import gcd
from sys import setrecursionlimit
setrecursionlimit(4100000)
mod = 10 ** 9 + 7
n = int(input())
zeros = 0
d = {}
for i in range(n):
	(x, y) = map(int, input().split())
	if x == 0 and y == 0:
		zeros += 1
	else:
		g = gcd(x, y)
		(x, y) = (x // g, y // g)
		if y < 0 or (y == 0 and x < 0):
			(x, y) = (-x, -y)
		else:
			pass
		if x <= 0:
			sq = True
			(x, y) = (y, -x)
		else:
			sq = False
		if sq == True:
			if (x, y) in d:
				d[x, y][1] += 1
			else:
				d[x, y] = [0, 1]
		elif (x, y) in d:
			d[x, y][0] += 1
		else:
			d[x, y] = [1, 0]

def mod_pow(a: int, b: int, mod: int) -> int:
	if b == 0:
		return 1 % mod
	elif b % 2 == 0:
		return mod_pow(a, b // 2, mod) ** 2 % mod
	elif b == 1:
		return a % mod
	else:
		return mod_pow(a, b // 2, mod) ** 2 * a % mod
ans = 1
for ((a, b), (k, l)) in d.items():
	now = 1
	now = (now + mod_pow(2, k, mod) - 1) % mod
	now = (now + mod_pow(2, l, mod) - 1) % mod
	ans = ans * now % mod
ans -= 1
zeros = zeros % mod
ans = (ans + zeros) % mod
print(ans)


from math import gcd
mod = 1000000007
n = int(input())
counter = {}
zeros = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zeros += 1
		continue
	g = gcd(a, b)
	a //= g
	b //= g
	if b < 0:
		a = -a
		b = -b
	if b == 0 and a < 0:
		a = -a
	counter[a, b] = counter.get((a, b), 0) + 1
counted = set()
ans = 1
for (s, s_count) in counter.items():
	if s not in counted:
		if s[0] > 0 and s[1] >= 0:
			t = (-s[1], s[0])
		else:
			t = (s[1], -s[0])
		t_count = counter.get(t, 0)
		now = pow(2, s_count, mod) - 1
		now += pow(2, t_count, mod) - 1
		now += 1
		ans *= now
		ans %= mod
		counted.add(s)
		counted.add(t)
print((ans - 1 + zeros) % mod)


from math import gcd
from collections import defaultdict
N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]
d = {}
for (a, b) in X:
	if a == b == 0:
		pass
	elif a == 0:
		if b > 0:
			b = 1
		else:
			b = -1
	elif b == 0:
		if a > 0:
			a = 1
		else:
			a = -1
	else:
		v = gcd(a, b)
		a //= v
		b //= v
	if a != 0 and a * b >= 0:
		pair = (abs(a), abs(b))
		if pair not in d:
			d[pair] = [0, 0]
		d[pair][0] += 1
	else:
		pair = (abs(b), abs(a))
		if pair not in d:
			d[pair] = [0, 0]
		d[pair][1] += 1
MOD = 10 ** 9 + 7
zero = 0
ans = 1
for p in d:
	if p == (0, 0):
		zero = d[p][1]
	else:
		(a, b) = d[p]
		ans *= pow(2, a, MOD) + pow(2, b, MOD) - 1
		ans %= MOD
print((ans + zero - 1) % MOD)


n = int(input())
mod = 10 ** 9 + 7
from collections import defaultdict
pp = defaultdict(lambda : 0)
pm = defaultdict(lambda : 0)

def seiki(x, y):
	tmp = gcd(x, y)
	return (x // tmp, y // tmp)
from math import gcd
zero = 0
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zero += 1
	elif a * b > 0:
		tmp = seiki(abs(a), abs(b))
		pp[tmp] += 1
	elif a == 0:
		pp[1, 0] += 1
	elif b == 0:
		pm[1, 0] += 1
		pp[1, 0] += 0
	else:
		tmp = seiki(abs(b), abs(a))
		pm[tmp] += 1
		pp[tmp] += 0
result = 1
for key in pp.keys():
	pp_v = pp[key]
	pm_v = pm[key]
	result *= pow(2, pm_v, mod) + pow(2, pp_v, mod) - 1
	result %= mod
print((result - 1 + zero) % mod)


from collections import Counter
import math
n = int(input())
ab = []
mod = 10 ** 9 + 7
num_ab0 = 0
num_a0 = 0
num_b0 = 0
for i in range(n):
	(A, B) = map(int, input().split())
	if A == 0 and B == 0:
		num_ab0 += 1
	elif A == 0:
		num_a0 += 1
	elif B == 0:
		num_b0 += 1
	else:
		g = math.gcd(A, B)
		if A < 0:
			A = -A
			B = -B
		ab.append((A // g, B // g))
c = Counter(ab)
total = 2 ** num_a0 + 2 ** num_b0 - 1
for (k, v) in c.items():
	if k[1] < 0:
		num = c.get((-k[1], k[0]))
	else:
		num = c.get((k[1], -k[0]))
	if num:
		if k[1] > 0:
			total *= 2 ** v + 2 ** num - 1
	else:
		total *= 2 ** v
print((total - 1 + num_ab0) % mod)


from collections import defaultdict
from math import gcd
C = defaultdict(lambda : 0)
for i in range(int(input())):
	(x, y) = map(int, input().split())
	g = max(gcd(x, y), 1)
	(x, y) = (x // g, y // g)
	if y < 0 or (x == -1 and y == 0):
		(x, y) = (-x, -y)
	C[x, y] += 1
S = set()
for (x, y) in C:
	if x > 0 and y >= 0:
		S.add((x, y))
	if x <= 0 and y > 0:
		S.add((y, -x))
ans = 1
p = 10 ** 9 + 7
for (x, y) in S:
	ans *= pow(2, C[x, y], p) + pow(2, C[-y, x], p) - 1
	ans %= p
print((ans + C[0, 0] - 1) % p)


from sys import stdin, setrecursionlimit
from collections import defaultdict
from math import gcd
setrecursionlimit(10 ** 9)
INF = 1 << 60

def input():
	return stdin.readline().strip()
MOD = 1000000007
N = int(input())
d = defaultdict(int)
zeros = 0
for i in range(N):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zeros += 1
	else:
		g = gcd(a, b)
		a //= g
		b //= g
		if a < 0:
			a *= -1
			b *= -1
		if a == 0 and b == -1:
			b = 1
		d[a, b] += 1
ans = 1
free = 0
for ((a, b), n) in d.items():
	if b > 0:
		if (b, -a) in d:
			m = d[b, -a]
			ans = ans * (pow(2, n, MOD) + pow(2, m, MOD) - 1) % MOD
		else:
			free += n
	elif (-b, a) not in d:
		free += n
ans = (ans * pow(2, free, MOD) + zeros - 1) % MOD
print(ans)


n = int(input())
zeros = 0
ab = {}
for _ in range(n):
	(a, b) = [int(i) for i in input().split()]
	if a == b == 0:
		zeros += 1
	elif a == 0 or b == 0:
		if None not in ab:
			ab[None] = [0, 0]
		if a == 0:
			ab[None][0] += 1
		else:
			ab[None][1] += 1
	else:
		x = 1 if a * b > 0 else -1
		c = max(abs(a) * 10 ** 100 // abs(b) * x, abs(b) * 10 ** 100 // abs(a) * -x)
		if c not in ab:
			ab[c] = [0, 0]
		if a * b > 0:
			ab[c][0] += 1
		else:
			ab[c][1] += 1
ans = 1
mod = 10 ** 9 + 7
for (_, v) in ab.items():
	ans *= pow(2, v[0], mod) + pow(2, v[1], mod) - 1
	ans %= mod
ans += zeros - 1
print(ans % mod)


from collections import defaultdict
import math
N = int(input())
m = defaultdict(lambda : 0)
BIG_NUMBER = 1000000007
bad_iwashi_count = 0
for _ in range(N):
	(A, B) = map(int, input().split())
	if A == 0 and B == 0:
		bad_iwashi_count += 1
		continue
	if A == 0:
		m[-1, 0, 1] += 1
		continue
	if B == 0:
		m[1, 1, 0] += 1
		continue
	gcd_ = math.gcd(A, B)
	A = A // gcd_
	B = B // gcd_
	if A < 0 and B > 0:
		m[-1, -A, B] += 1
	elif B < 0 and A > 0:
		m[-1, A, -B] += 1
	elif A < 0 and B < 0:
		m[1, -A, -B] += 1
	elif A > 0 and B > 0:
		m[1, A, B] += 1
total = 1
for key in list(dict(m).keys()):
	total *= pow(2, m[key], BIG_NUMBER) + pow(2, m[-key[0], key[2], key[1]], BIG_NUMBER) - 1
	total %= BIG_NUMBER
	m.pop(key)
	m.pop((-key[0], key[2], key[1]))
print((total + bad_iwashi_count - 1) % BIG_NUMBER)


from math import gcd
n = int(input())
mod = 10 ** 9 + 7
d1 = dict()
d2 = dict()
zero = 0
zeroa = 0
zerob = 0
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zero += 1
	elif a == 0 and b != 0:
		zeroa += 1
	elif a != 0 and b == 0:
		zerob += 1
	else:
		g = gcd(abs(a), abs(b))
		na = a // g
		nb = b // g
		if na < 0:
			na = -na
			nb = -nb
		if (na, nb) not in d1 and (na, nb) not in d2:
			d1[na, nb] = 1
			d2[-nb, na] = 0
			d2[nb, -na] = 0
		elif (na, nb) in d1:
			d1[na, nb] += 1
		else:
			d2[na, nb] += 1
d1 = list(d1.items())
ans = pow(2, zeroa, mod) + pow(2, zerob, mod) - 1
ans %= mod
for ((a, b), cnt1) in d1:
	cnt2 = 0
	cnt2 += d2[-b, a]
	cnt2 += d2[b, -a]
	ans *= pow(2, cnt1, mod) + pow(2, cnt2, mod) - 1
	ans %= mod
ans += zero
ans = (ans + mod - 1) % mod
print(ans)


from math import gcd
MOD = 10 ** 9 + 7
N = int(input())
d = dict()
zeros = 0
for _ in range(N):
	(a, b) = tuple(map(int, input().split()))
	if not any((a, b)):
		zeros += 1
		continue
	g = gcd(a, b) * (a // abs(a)) if all((a, b)) else a if a else b
	p = (a // g, b // g)
	d[p] = d.get(p, 0) + 1
done = set()
total = 1
for ((a, b), v) in d.items():
	if (b, -a) in done or (-b, a) in done:
		continue
	done.add((a, b))
	w = d.get((b, -a), 0) + d.get((-b, a), 0)
	total = total * (pow(2, v, MOD) + pow(2, w, MOD) - 1) % MOD
print((total + zeros + MOD - 1) % MOD)


def gcd(a, b):
	if b == 0 or a == 0:
		return a + b
	return gcd(b, a % b)
N = int(input())
d1 = {}
d2 = {}
zero = 0
for _ in range(N):
	(A, B) = map(int, input().split())
	if A == 0 and B == 0:
		zero += 1
		continue
	d = gcd(abs(A), abs(B))
	(A, B) = (A // d, B // d)
	if B < 0 or (B == 0 and A < 0):
		(A, B) = (-A, -B)
	if A > 0:
		if (A, B) not in d1:
			d1[A, B] = 0
		d1[A, B] += 1
	else:
		if (A, B) not in d2:
			d2[A, B] = 0
		d2[A, B] += 1
ret = []
for ((x, y), count) in d1.items():
	if (-y, x) in d2:
		ret.append((count, d2[-y, x]))
	else:
		ret.append((count, 0))
for ((x, y), count) in d2.items():
	if (y, -x) not in d1:
		ret.append((count, 0))
mod = 10 ** 9 + 7
ans = 1
for (p, q) in ret:
	if q == 0:
		ans *= 2 ** p
		ans %= mod
	else:
		ans *= 2 ** p + 2 ** q - 1
		ans %= mod
print((ans - 1 + zero) % mod)


import math
n = int(input())
mod = 10 ** 9 + 7
d = {}
zero = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zero += 1
	else:
		g = math.gcd(a, b)
		a //= g
		b //= g
		if b < 0:
			a = -a
			b = -b
		if b == 0 and a == -1:
			a = 1
		if a > 0:
			if (a, b) in d:
				d[a, b][0] += 1
			else:
				d[a, b] = [1, 0]
		elif (b, -a) in d:
			d[b, -a][1] += 1
		else:
			d[b, -a] = [0, 1]
ans = 1
for ((a, b), (c, d)) in d.items():
	count = (pow(2, c, mod) + pow(2, d, mod) - 1) % mod
	ans *= count
	ans %= mod
print((ans + zero - 1) % mod)


from math import gcd
n = int(input())
ration = dict()
used = dict()
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	if a == 0 or b == 0:
		if a == b == 0:
			r = '0'
		elif a == 0:
			r = '0a'
		else:
			r = '0b'
	else:
		s = '-' if (a < 0) ^ (b < 0) else '+'
		a = abs(a)
		b = abs(b)
		g = gcd(a, b)
		r = f'{s} {a // g} {b // g}'
	ration[r] = ration.get(r, 0) + 1
	used[r] = 0
res = 1
mod = 10 ** 9 + 7
add = 0
for (k, v) in list(ration.items()):
	if used[k]:
		continue
	if k == '0':
		add += v
		used[k] = 1
	elif k == '0a' or k == '0b':
		res *= 2 ** ration.get('0a', 0) + 2 ** ration.get('0b', 0) - 1
		used['0a'] = used['0b'] = 1
	else:
		r = k.split()
		l = f"{('-' if r[0] == '+' else '+')} {r[2]} {r[1]}"
		res *= 2 ** v + 2 ** ration.get(l, 0) - 1
		used[k] = used[l] = 1
	res %= mod
res += add
res -= 1
if res < 0:
	res += mod
print(res)


from math import gcd
from collections import defaultdict as d
n = int(input())
m = 10 ** 9 + 7
s = d(lambda : [0, 0])
p = -1
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b == 0:
		p += 1
	else:
		g = gcd(a, b)
		a = a // g
		b = b // g
		if a < 0 or a == 0 < b:
			(a, b) = (-a, -b)
		if b < 0:
			s[-b, a][1] += 1
		else:
			s[a, b][0] += 1
q = 1
for i in s:
	(k, l) = s[i]
	q = q * (pow(2, k, m) + pow(2, l, m) - 1) % m
print((q + p) % m)


N = int(input())
from collections import defaultdict
import math
d = defaultdict(int)
MOD = 10 ** 9 + 7
for i in range(N):
	(a, b) = map(int, input().split())
	x = math.gcd(abs(a), abs(b))
	if a == 0:
		if b == 0:
			k = (0, 0)
		else:
			k = (0, 1)
	elif b == 0:
		k = (1, 0)
	else:
		if a < 0:
			(a, b) = (-a, -b)
		if b < 0:
			(a, b) = (a // x, -(-b // x))
		else:
			(a, b) = (a // x, b // x)
		k = (a, b)
	d[k] += 1
ind = defaultdict(int)
index = 1
_ans = [1]
for (a, b) in list(d.keys()):
	if a == b == 0:
		continue
	if b <= 0:
		_k = (-b, a)
	else:
		_k = (b, -a)
	if d[_k] == 0:
		_ans[0] *= pow(2, d[a, b])
	elif ind[_k] == 0:
		_ans.append(pow(2, d[a, b], MOD))
		ind[a, b] = index
		index += 1
	else:
		_ans[ind[_k]] += pow(2, d[a, b], MOD) - 1
ans = 1
for a in _ans:
	ans = ans * a % MOD
print((d[0, 0] + ans - 1 + MOD) % MOD)


from collections import defaultdict
from math import gcd
N = int(input())
MOD = 1000000007
d = defaultdict(int)
num_00 = 0
pow2 = [1]
for i in range(N):
	pow2.append(pow2[-1] * 2 % MOD)

def to_idx(a, b):
	if a == 0 and b != 0:
		return ((0, -1), (0, 1))
	elif a != 0 and b == 0:
		return ((-1, 0), (1, 0))
	else:
		return tuple(sorted(((a, b), (-a, -b))))
ans = 0
for i in range(N):
	(a, b) = map(int, input().split())
	if a * b == 0 and a != b:
		d[to_idx(a, b)] += 1
	elif a == b == 0:
		num_00 += 1
	else:
		g = gcd(a, b)
		a //= g
		b //= g
		d[to_idx(a, b)] += 1
memo = []
key_set = set(d.keys())
while key_set:
	k = key_set.pop()
	(v1, v2) = k
	(a, b) = v1
	idx = to_idx(-b, a)
	memo.append((pow2[d[k]] + pow2[d[idx]] - 1) % MOD)
	key_set.discard(idx)
ans = 1
for m in memo:
	ans *= m
	ans %= MOD
print((ans - 1 + num_00) % MOD)


import math
import collections
from collections import defaultdict
n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
mod = 10 ** 9 + 7
L = []
ct0 = 0
for i in range(n):
	if l[i][0] == 0 and l[i][1] == 0:
		ct0 += 1
	elif l[i][0] == 0:
		L.append((0, 1))
	elif l[i][1] == 0:
		L.append((1, 0))
	elif l[i][0] < 0:
		L.append((-l[i][0] // math.gcd(l[i][0], l[i][1]), -l[i][1] // math.gcd(l[i][0], l[i][1])))
	else:
		L.append((l[i][0] // math.gcd(l[i][0], l[i][1]), l[i][1] // math.gcd(l[i][0], l[i][1])))
ans = 1
d = set()
c = collections.Counter(L)
for i in c.keys():
	if i[0] == 0:
		x = (1, 0)
	elif i[1] == 0:
		x = (0, 1)
	elif i[1] < 0:
		x = (-i[1], i[0])
	else:
		x = (i[1], -i[0])
	if i not in d:
		ans *= pow(2, c[i], mod) + pow(2, c[x], mod) - 1
		ans %= mod
		d.add(x)
print((ans - 1 + ct0) % mod)


from collections import defaultdict
from math import gcd
N = int(input())
mod = 10 ** 9 + 7
D = defaultdict(int)
corner = 0
D[0, 1] = 0
D[1, 0] = 0
for i in range(N):
	(x, y) = map(int, input().split())
	if x * y != 0:
		(x, y) = (x // gcd(x, y), y // gcd(x, y))
		if y > 0:
			D[x, y] += 1
		elif y < 0:
			D[-x, -y] += 1
	elif x == 0 and y == 0:
		corner += 1
		continue
	elif x == 0:
		D[0, 1] += 1
	elif y == 0:
		D[1, 0] += 1
ans = corner
c = 1
sub = []
for (x, y) in D.keys():
	if x < 0 and y > 0:
		if not (y, -x) in D.keys():
			sub.append((y, -x))
for some in sub:
	D[some] = 0
K = list(D.keys())
for (x, y) in K:
	if x > 0 and y > 0:
		a = D[x, y]
		b = D[-y, x]
		c *= pow(2, a, mod) + pow(2, b, mod) - 1
		c %= mod
	elif y == 0:
		a = D[1, 0]
		b = D[0, 1]
		c *= pow(2, a, mod) + pow(2, b, mod) - 1
		c %= mod
ans += c - 1
print(ans % mod)


N = int(input())
AB = [list(map(int, input().split())) for _ in [0] * N]
mod = 1000000007

def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)
c = {}
n0 = 0
for (a, b) in AB:
	if a == b == 0:
		n0 += 1
	elif a == 0:
		c[0, 1] = c.get((0, 1), 0) + 1
	elif b == 0:
		c[1, 0] = c.get((1, 0), 0) + 1
	else:
		g = gcd(a, b)
		(a, b) = (a // g, b // g)
		if a < 0:
			a *= -1
			b *= -1
		c[a, b] = c.get((a, b), 0) + 1
ans = 1
done = set()
for (k, n) in c.items():
	if k in done:
		continue
	(a, b) = k
	if b > 0:
		(an, bn) = (b, -a)
	else:
		(an, bn) = (-b, a)
	m = c.get((an, bn), 0)
	ans *= (pow(2, n, mod) + pow(2, m, mod) - 1) % mod
	ans %= mod
	done.add((a, b))
	done.add((an, bn))
ans = ans - 1 + n0
ans %= mod
print(ans)


from math import gcd
n = int(input())
P = [tuple(map(int, input().split())) for i in range(n)]
C = {}
for (x, y) in P:
	if x == 0 and y == 0:
		(x0, y0) = (0, 0)
	elif x != 0 and y == 0:
		(x0, y0) = (1, 0)
	elif x == 0 and y != 0:
		(x0, y0) = (0, 1)
	else:
		g = gcd(x, y)
		(x0, y0) = (x // g, y // g)
	if y0 < 0:
		(x0, y0) = (-x0, -y0)
	try:
		C[x0, y0] += 1
	except KeyError:
		C[x0, y0] = 1
D = []
for (x, y) in C.keys():
	if x <= 0:
		try:
			C[y, -x]
		except KeyError:
			D.append((y, -x))
for (x, y) in D:
	C[x, y] = 0
ans = 1
p = 10 ** 9 + 7
for (x, y) in C.keys():
	if x > 0:
		a = C[x, y]
		try:
			b = C[-y, x]
		except KeyError:
			b = 0
		ans *= pow(2, a, p) + pow(2, b, p) - 1
		ans %= p
try:
	ans += C[0, 0] - 1
except KeyError:
	ans -= 1
print(ans % p)


from math import gcd
mod = 1000000007
n = int(input())
counter = {}
zeros = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zeros += 1
		continue
	g = gcd(a, b)
	a //= g
	b //= g
	if b < 0:
		a = -a
		b = -b
	if b == 0 and a < 0:
		a = -a
	rot90 = a <= 0
	if rot90:
		(a, b) = (b, -a)
	count = counter.get((a, b), [0, 0])
	if rot90:
		count[0] += 1
	else:
		count[1] += 1
	counter[a, b] = count
ans = 1
for (k, pairs) in counter.items():
	s_count = pairs[0]
	t_count = pairs[1]
	now = pow(2, s_count, mod) - 1
	now += pow(2, t_count, mod) - 1
	now += 1
	ans *= now
	ans %= mod
print((ans - 1 + zeros) % mod)


import collections
n = int(input())
A = []
AA = []
B = []
C = []
X = []
mod = 10 ** 9 + 7
p = 137053438808121949
for i in range(n):
	(a, b) = map(int, input().split())
	if a < 0:
		a = a * -1
		b = b * -1
	if a * b > 0:
		A.append(b * pow(a, p - 2, p) % p)
	elif a * b < 0:
		AA.append(a * pow(-b, p - 2, p) % p)
	elif a == 0 and b == 0:
		X.append(i)
	elif a == 0:
		B.append(i)
	else:
		C.append(i)
D = collections.Counter(A)
DD = collections.Counter(AA)
E = set(list(D) + list(DD))
a = 1
for i in E:
	a = a * (2 ** D[i] + 2 ** DD[i] - 1) % mod
a = (a * (2 ** len(B) + 2 ** len(C) - 1) - 1) % mod
print((a + len(X)) % mod)


from collections import defaultdict
from math import gcd
mod = 10 ** 9 + 7
n = int(input())
fishes = defaultdict(int)
zero_zero = 0
zero = 0
inf = 0
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	if a == 0 and b == 0:
		zero_zero += 1
	elif a == 0:
		zero += 1
	elif b == 0:
		inf += 1
	else:
		div = gcd(a, b)
		a //= div
		b //= div
		if b < 0:
			a *= -1
			b *= -1
		key = (a, b)
		fishes[key] += 1

def get_bad_pair(fish):
	(a, b) = fish
	if a < 0:
		a *= -1
		b *= -1
	return (-b, a)
ans = 1
counted_key = set()
for (fish_key, count) in list(fishes.items()):
	if fish_key in counted_key:
		continue
	bad_pair = get_bad_pair(fish_key)
	if bad_pair in fishes:
		pair_count = fishes[bad_pair]
		pattern = pow(2, count, mod) + pow(2, pair_count, mod) - 1
		counted_key.add(bad_pair)
	else:
		pattern = pow(2, count, mod)
	ans = ans * pattern % mod
ans *= pow(2, zero, mod) + pow(2, inf, mod) - 1
if zero_zero:
	ans += zero_zero
ans -= 1
print(ans % mod)


from collections import Counter
import math
MOD = 10 ** 9 + 7
N = int(input())
li = []
zcnt = 0
(az, bz) = (0, 0)
for i in range(N):
	(A, B) = map(int, input().split())
	if A == 0 and B == 0:
		zcnt += 1
		continue
	if A != 0 and B == 0:
		bz += 1
		continue
	elif A == 0 and B != 0:
		az += 1
		continue
	g = math.gcd(A, B)
	if A < 0 and B < 0:
		li.append((-(A // g), -(B // g)))
	elif A < 0 and B > 0:
		li.append((-(A // g), -(B // g)))
	else:
		li.append((A // g, B // g))
c = Counter(li)
dic = {}
ans = (pow(2, az, MOD) + pow(2, bz, MOD) - 1 + MOD) % MOD
for (a, b) in c.keys():
	if (a, b) in dic:
		continue
	(l, r) = ((-b, a), (b, -a))
	s = c.get(l, 0) + c.get(r, 0)
	(dic[l], dic[r]) = (1, 1)
	res = (pow(2, c[a, b], MOD) + pow(2, s, MOD) - 1 + MOD) % MOD
	ans = ans * res % MOD
print((ans - 1 + zcnt) % MOD)


import math
from collections import deque
N = int(input())
a = []
b = []
for i in range(N):
	(i1, i2) = list(map(int, input().split()))
	g = math.gcd(i1, i2)
	if g == 0:
		a.append(i1)
		b.append(i2)
		continue
	x = i1 // g
	y = i2 // g
	if x < 0:
		x = -x
		y = -y
	a.append(x)
	b.append(y)
P = {}
for i in range(N):
	if b[i] < 0:
		tmp = b[i]
		b[i] = a[i]
		a[i] = -tmp
		sgn = 1
	elif a[i] == 0 and b[i] != 0:
		a[i] = b[i]
		b[i] = 0
		sgn = 1
	else:
		sgn = 0
	if (a[i], b[i]) in P:
		P[a[i], b[i]][sgn] = P[a[i], b[i]][sgn] + 1
	elif sgn == 0:
		P[a[i], b[i]] = [1, 0]
	else:
		P[a[i], b[i]] = [0, 1]
MOD = 1000000007
a1 = 1
ans0 = 0
for k in P:
	if k == (0, 0):
		ans0 = P[k][0]
	else:
		a1 = a1 * (pow(2, P[k][0], MOD) + pow(2, P[k][1], MOD) - 1) % MOD
if ans0 != 0:
	ans = ans0 + a1 - 1
else:
	ans = a1 - 1
print(ans % MOD)


from math import gcd
from collections import defaultdict
n = int(input())
abd = defaultdict(int)
mod = 10 ** 9 + 7
wzero = 0
azero = 0
bzero = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		wzero += 1
	elif a == 0 and b != 0:
		azero += 1
	elif a != 0 and b == 0:
		bzero += 1
	else:
		g = gcd(a, b)
		a = a // g
		b = b // g
		abd[a, b] += 1
liskey = list(abd.keys())
ans = 1
for k in liskey:
	if abd[k] != 0:
		(a, b) = k
		x = abd[a, b] + abd[-a, -b]
		y = abd[-b, a] + abd[b, -a]
		abd[a, b] = 0
		abd[-a, -b] = 0
		abd[-b, a] = 0
		abd[b, -a] = 0
		ans *= (2 ** x + 2 ** y - 1 + mod) % mod
		ans %= mod
ans *= 2 ** azero + 2 ** bzero - 1
ans %= mod
ans = (ans + wzero) % mod
ans = (ans + mod - 1) % mod
print(ans)


def resolve():
	import math
	from fractions import Fraction
	mod = 10 ** 9 + 7
	n = int(input())
	enpty = 0
	dic1 = {}
	for i in range(n):
		(a, b) = map(int, input().split())
		if a == 0 and b == 0:
			enpty += 1
		else:
			c = math.gcd(a, b)
			a = a // c
			b = b // c
			if b < 0 or (b == 0 and a < 0):
				a = -a
				b = -b
			if (a, b) in dic1:
				dic1[a, b] += 1
			else:
				dic1[a, b] = 1
	ans = 1
	for ((a, b), num) in dic1.items():
		if (-b, a) in dic1:
			ans = ans * (pow(2, num, mod) + pow(2, dic1[-b, a], mod) - 1) % mod
		elif not (b, -a) in dic1:
			ans = ans * pow(2, num, mod) % mod
	print((ans - 1 + enpty) % mod)
resolve()


from collections import defaultdict
from math import gcd
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
mod = 10 ** 9 + 7
MAX = 2 * 10 ** 5
p = defaultdict(int)
m = defaultdict(int)
ab0 = 0
for (a, b) in ab:
	if a == 0 and b == 0:
		ab0 += 1
	elif a == 0:
		m[0, 1] += 1
		p[1, 0]
	elif b == 0:
		p[1, 0] += 1
	else:
		g = gcd(a, b)
		a //= g
		b //= g
		sign = a * b
		a = abs(a)
		b = abs(b)
		if sign < 0:
			m[a, b] += 1
			p[b, a]
		else:
			p[a, b] += 1
power = [1]
for _ in range(MAX):
	power.append(power[-1] * 2 % mod)
ans = 1
for ((a, b), v) in p.items():
	ans *= power[v] + power[m[b, a]] - 1
	ans %= mod
ans -= 1
ans += ab0
ans %= mod
print(ans)


ma = lambda : map(int, input().split())
lma = lambda : list(map(int, input().split()))
tma = lambda : tuple(map(int, input().split()))
ni = lambda : int(input())
yn = lambda fl: print('Yes') if fl else print('No')
import collections
import math
import itertools
import heapq as hq
import sys
gcd = math.gcd
co = collections.Counter()
n = ni()
mod = 10 ** 9 + 7
for i in range(n):
	(a, b) = ma()
	d = gcd(a, b)
	if d != 0:
		a //= d
		b //= d
	elif abs(a) > 0 or abs(b) > 0:
		l = max(abs(a), abs(b))
		a //= l
		b //= l
	co[a, b] += 1
d = collections.defaultdict(lambda : False)
ans = 1
for (t, cnt) in co.items():
	(a, b) = t
	if t == (0, 0) or d[t]:
		continue
	d[a, b] = True
	d[-a, -b] = True
	d[b, -a] = True
	d[-b, a] = True
	l1 = co[a, b] + co[-a, -b]
	l2 = co[b, -a] + co[-b, a]
	ans = ans * (pow(2, l1, mod) + pow(2, l2, mod) - 1) % mod
	ans %= mod
print((ans - 1 + co[0, 0]) % mod)


from collections import defaultdict
from math import gcd
import sys
input = sys.stdin.readline
N = int(input())
mod = 10 ** 9 + 7
dic = defaultdict(lambda : [0, 0])
c = 0
d = 0
e = 0
for i in [0] * N:
	(A, B) = map(int, input().split())
	if A == 0 and B == 0:
		e += 1
	elif A == 0:
		c += 1
	elif B == 0:
		d += 1
	else:
		g = gcd(A, B)
		A //= g
		B //= g
		if A * B > 0:
			dic[abs(A), abs(B)][0] += 1
		else:
			dic[abs(B), abs(A)][1] += 1
ans = 1
for k in dic:
	ans = ans * (pow(2, dic[k][0], mod) + pow(2, dic[k][1], mod) - 1)
ans = ans * (pow(2, c, mod) + pow(2, d, mod) - 1)
print((ans - 1 + e) % mod)


from math import gcd
from collections import defaultdict
MOD = 10 ** 9 + 7
n = int(input())
cnt = defaultdict(lambda : [0, 0])
zeros = 0
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == b == 0:
		zeros += 1
		continue
	if a < 0 or (a == 0 and b < 0):
		a *= -1
		b *= -1
	g = gcd(a, b)
	a //= g
	b //= g
	if b > 0:
		cnt[a, b][0] += 1
	else:
		cnt[-b, a][1] += 1
ans = 1
for (v, v2) in cnt.values():
	ans *= 1 + pow(2, v, MOD) - 1 + pow(2, v2, MOD) - 1
	ans %= MOD
ans = (ans + zeros - 1) % MOD
print(ans)


from math import gcd

def to_standard_form(a, b):
	if a == 0:
		return (0, 1)
	g = gcd(a, b)
	a //= g
	b //= g
	if a < 0:
		return (-a, -b)
	return (a, b)
(N,) = map(int, input().split())
d = dict()
X = []
cc = 0
for _ in range(N):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		cc += 1
		continue
	f = to_standard_form(a, b)
	if f not in d:
		d[f] = 0
	d[f] += 1
	X.append(f)
vs = dict()
for (a, b) in X:
	f1 = (a, b)
	f2 = to_standard_form(-b, a)
	if f2 not in d:
		d[f2] = 0
	if f1 in vs or f2 in vs:
		continue
	vs[f1] = (d[f1], d[f2])
mod = 10 ** 9 + 7
r = 1
for k in vs:
	(a, b) = vs[k]
	r = r * (pow(2, a, mod) + pow(2, b, mod) - 1) % mod
print((r - 1 + cc) % mod)


from math import gcd
n = int(input())
ab = [map(int, input().split()) for _ in range(n)]
mod = 1000000007
pair = []
d = {}
d[0] = {}
d[0][0] = 0
for (a, b) in ab:
	x = gcd(a, b)
	if x != 0:
		a //= x
		b //= x
	pair.append((a, b))
	d.setdefault(a, {})
	d[a].setdefault(b, 0)
	d[a][b] += 1
used = set()
ans = 1
for (a, b) in pair:
	if (a, b) in used:
		continue
	used.add((a, b))
	if a == 0 and b == 0:
		continue
	i = d[a][b]
	(j, k, l) = (0, 0, 0)
	if -a in d and -b in d[-a]:
		j = d[-a][-b]
		used.add((-a, -b))
	if -b in d and a in d[-b]:
		k = d[-b][a]
		used.add((-b, a))
	if b in d and -a in d[b]:
		l = d[b][-a]
		used.add((b, -a))
	ans *= pow(2, i + j, mod) + pow(2, k + l, mod) - 1
	ans %= mod
ans += d[0][0] - 1
ans %= mod
print(ans)


from collections import defaultdict
from math import gcd
n = int(input())
zeros = 0
d = defaultdict(lambda : [0, 0])
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zeros += 1
		continue
	g = gcd(a, b)
	(a, b) = (a // g, b // g)
	if a == 0:
		b = 1
	if b == 0:
		a = 1
	if b < 0:
		(a, b) = (-a, -b)
	if a <= 0:
		d[b, -a][1] += 1
	else:
		d[a, b][0] += 1
mod = 1000000007
ans = 1
for v in d.values():
	ans = ans * (pow(2, v[0], mod) + pow(2, v[1], mod) - 1) % mod
ans = (ans - 1 + zeros) % mod
print(ans)


from math import gcd
from numpy import sign
mod = 1000000007
N = int(input())
d = {}
counter = 0
f = 0
l = 0
for _ in range(N):
	(a, b) = list(map(int, input().split()))
	if a == b == 0:
		counter += 1
	elif a == 0:
		f += 1
	elif b == 0:
		l += 1
	else:
		g = gcd(a, b)
		(a, b) = (a // g, b // g)
		if b < 0:
			(a, b) = (-a, -b)
		if (a, b) not in d:
			d[a, b] = 1
		else:
			d[a, b] += 1
answer = 1
group = set()
for ((p, q), v) in d.items():
	(invp, invq) = (-q, p)
	if invq < 0:
		(invp, invq) = (-invp, -invq)
	if not (invp, invq) in group:
		group.add((p, q))
for (p, q) in group:
	(invp, invq) = (-q, p)
	if invq < 0:
		(invp, invq) = (-invp, -invq)
	if (invp, invq) not in d:
		answer *= 2 ** d[p, q]
	else:
		answer *= 2 ** d[p, q] + 2 ** d[invp, invq] - 1
answer *= 2 ** f + 2 ** l - 1
print((answer + counter - 1) % mod)


from collections import defaultdict
from math import gcd
mod = 10 ** 9 + 7
n = int(input())
ab = [tuple(map(int, input().split())) for _ in range(n)]
d = defaultdict(int)
zero = 0
for (a, b) in ab:
	if a == b == 0:
		zero += 1
		continue
	if a == 0:
		d[0, 1] += 1
		continue
	if b == 0:
		d[1, 0] += 1
		continue
	if a < 0:
		a *= -1
		b *= -1
	g = gcd(a, b)
	d[a // g, b // g] += 1
all = n - zero
ans = 1
for (k1, v) in list(d.items()):
	k2 = (k1[1], -k1[0])
	if k2 in list(d.keys()):
		all -= v
		all -= d[k2]
		ans = ans * (pow(2, v, mod) + pow(2, d[k2], mod) - 1) % mod
ans = ans * pow(2, all, mod) % mod
print((ans - 1 + zero) % mod)


mod = 1000000007
from collections import defaultdict

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
d1 = defaultdict(lambda : 0)
d2 = defaultdict(lambda : 0)
ca = 0
cb = 0
cc = 0
for i in range(N):
	(a, b) = AB[i]
	if a == 0 and b != 0:
		ca += 1
		continue
	elif a != 0 and b == 0:
		cb += 1
		continue
	elif a == 0 and b == 0:
		cc += 1
		continue
	a_ = abs(a)
	b_ = abs(b)
	d = gcd(a, b)
	if d != 0:
		a //= d
		b //= d
	if a < 0:
		a *= -1
		b *= -1
	if b > 0:
		d1[a, b] += 1
	else:
		d2[a, b] += 1
		d1[-b, a] += 0
ans = pow(2, ca) + pow(2, cb) - 1
for (a, b) in d1:
	x = d1[a, b]
	y = d2[b, -a]
	ans *= pow(2, x, mod) + pow(2, y, mod) - 1
	ans %= mod
ans -= 1
ans += cc
ans %= mod
print(ans)


import math, sys
input = sys.stdin.readline
from collections import defaultdict
n = int(input())
MOD = 1000000007
d = defaultdict(int)
(l, r) = (0, 0)
count = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b == 0:
		count += 1
		continue
	elif a == 0 or b == 0:
		if a == 0:
			l += 1
		else:
			r += 1
	else:
		g = math.gcd(a, b)
		(a, b) = (a // g, b // g)
		if a < 0:
			(a, b) = (-a, -b)
		d[str(a) + ':' + str(b)] += 1
c = 1
for i in d.keys():
	if d[i] != 0:
		cur = pow(2, d[i], MOD)
		if '-' in i:
			ind = i.index(':')
			ci = i[ind + 2:] + ':' + i[:ind]
		else:
			ind = i.index(':')
			ci = i[ind + 1:] + ':-' + i[:ind]
		if ci in d.keys():
			cur += pow(2, d[ci], MOD) - 1
			d[ci] = 0
		c = c * cur % MOD
c = (c * (pow(2, l, MOD) + pow(2, r, MOD) - 1) - 1 + count) % MOD
print(c)


N = int(input())
D = {}

def gcd(x, y):
	if x > y:
		(x, y) = (y, x)
	while x:
		(x, y) = (y % x, x)
	return y
for _ in range(N):
	(A, B) = map(int, input().split())
	if A == 0 and B == 0:
		key = (0, 0)
	elif A == 0:
		key = (0, 1)
	elif B == 0:
		key = (1, 0)
	else:
		if A < 0:
			A = -A
			B = -B
		g = gcd(A, abs(B))
		key = (A // g, B // g)
	if key not in D:
		D[key] = 0
	D[key] += 1
mod = 10 ** 9 + 7
ans = 1
n00 = 0
for (k1, v1) in D.items():
	if k1 == (0, 0):
		n00 += v1
		continue
	if v1 == 0:
		continue
	k2 = (k1[1], -k1[0]) if k1[1] > 0 else (-k1[1], k1[0])
	if k2 not in D:
		ans = ans * pow(2, v1, mod) % mod
	else:
		v2 = D[k2]
		m = (pow(2, v1, mod) + pow(2, v2, mod) - 1) % mod
		ans = ans * m % mod
		D[k2] = 0
print((ans + n00 - 1) % mod)


import math
N = int(input())
dic = {}
zz = 0
az = 0
bz = 0
for i in range(N):
	(A, B) = map(int, input().split())
	if A == B == 0:
		zz += 1
	elif A == 0:
		az += 1
	elif B == 0:
		bz += 1
	else:
		g = math.gcd(A, B)
		A //= g
		B //= g
		if A * B > 0:
			now = (A, B)
			ind = 0
		else:
			now = (-1 * B, A)
			ind = 1
		if now[0] < 0:
			now = (-1 * now[0], -1 * now[1])
		if now not in dic:
			dic[now] = [0, 0]
		dic[now][ind] += 1
mod = 10 ** 9 + 7
ans = pow(2, az, mod) + pow(2, bz, mod) - 1
for i in dic:
	(aa, bb) = dic[i]
	now = pow(2, aa, mod) + pow(2, bb, mod) - 1
	ans *= now
	ans %= mod
print((ans - 1 + zz) % mod)


N = int(input().strip())
AB_list = [list(map(int, input().rstrip().split())) for i in range(N)]

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
fish = {}
cnt_A0_B0 = 0
cnt_A0_Bj = 0
cnt_Ai_B0 = 0
mod = 10 ** 9 + 7
for (a, b) in AB_list:
	if a == b == 0:
		cnt_A0_B0 += 1
	elif a == 0:
		cnt_A0_Bj += 1
	elif b == 0:
		cnt_Ai_B0 += 1
	else:
		g = gcd(abs(a), abs(b))
		a //= g
		b //= g
		if a < 0:
			a *= -1
			b *= -1
		fish.setdefault((a, b), 0)
		fish[a, b] += 1
ans = 1
used = set()
for (key_a, key_b) in fish:
	if (key_a, key_b) not in used:
		if key_b >= 0:
			key_reverse = (key_b, -key_a)
		else:
			key_reverse = (-key_b, key_a)
		if key_reverse in fish:
			ans *= (pow(2, fish[key_a, key_b], mod) - 1 + (pow(2, fish[key_reverse], mod) - 1) + 1) % mod
			ans %= mod
			used.add(key_reverse)
		else:
			ans *= pow(2, fish[key_a, key_b], mod)
			ans %= mod
ans *= (2 ** cnt_A0_Bj - 1 + (2 ** cnt_Ai_B0 - 1) + 1) % mod
ans %= mod
ans += cnt_A0_B0
ans %= mod
ans -= 1
ans = (ans + mod) % mod
print(ans)


import sys, pprint, math
from fractions import Fraction
from collections import defaultdict
MOD = 1000000007
N = int(input())
params = []
hatemasks = []
tilts = defaultdict(lambda : [0, 0])
zerozero = 0
zerodiv = 0
for i in range(N):
	(ai, bi) = map(int, input().split())
	if ai == 0 and bi == 0:
		zerozero += 1
		continue
	if ai < 0 or (ai == 0 and bi < 0):
		ai *= -1
		bi *= -1
	g = math.gcd(ai, bi)
	ai = ai // g
	bi = bi // g
	if bi > 0:
		tilts[ai, bi][0] += 1
	else:
		tilts[-bi, ai][1] += 1
print(tilts, file=sys.stderr)
ans = 1
for (v1, v2) in tilts.values():
	ans *= 1 + pow(2, v1, MOD) - 1 + pow(2, v2, MOD) - 1
	ans %= MOD
ans = (ans + zerozero - 1) % MOD
print(ans)


N = int(input())
AB = [[int(_) for _ in input().split()] for i in range(N)]
from math import gcd

def normalize(x, y):
	if x == 0 and y == 0:
		return (0, 0)
	if x == 0:
		return (0, 1)
	if y == 0:
		return (1, 0)
	if x < 0:
		(x, y) = (-x, -y)
	d = gcd(x, y)
	return (x // d, y // d)

def rev(x, y):
	(x, y) = (-y, x)
	if x < 0:
		(x, y) = (-x, -y)
	return (x, y)
xs = {}
xszero = 0
for (a, b) in AB:
	if a == 0 and b == 0:
		xszero += 1
		continue
	nab = normalize(a, b)
	rab = rev(*nab)
	if nab in xs:
		xs[nab][0] += 1
	elif rab in xs:
		xs[rab][1] += 1
	else:
		xs[nab] = [1, 0]
M = 1000000007
result = 1
for (ab, nm) in xs.items():
	k = (pow(2, nm[0], M) + pow(2, nm[1], M) - 1) % M
	result = result * k % M
print((result - 1 + xszero) % M)


from collections import defaultdict
import math
mod = 1000000007
pos = defaultdict(int)
neg = defaultdict(int)
zero = 0
n = int(input())
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	if a == b == 0:
		zero += 1
	elif a == 0:
		pos[0, 1] += 1
	elif b == 0:
		neg[0, 1] += 1
	else:
		c = a * b
		g = math.gcd(a, b)
		(a, b) = (abs(a // g), abs(b // g))
		if c > 0:
			pos[a, b] += 1
		elif c < 0:
			neg[b, a] += 1
cnt = 1
for x in pos.keys():
	if x in neg.keys():
		cnt = cnt * (pow(2, pos[x], mod) + pow(2, neg[x], mod) - 1) % mod
		del neg[x]
	else:
		cnt = cnt * pow(2, pos[x], mod) % mod
for x in neg.keys():
	cnt = cnt * pow(2, neg[x], mod) % mod
print((zero + cnt - 1) % mod)


from collections import Counter
import sys
import math
from functools import cmp_to_key
sys.setrecursionlimit(10 ** 6)
mod = 1000000007
inf = int(1e+18)

def main():
	n = int(input())
	p = [tuple(map(int, input().split())) for i in range(n)]
	a = {}
	b = {}
	c = 0
	for (x, y) in p:
		if x == y == 0:
			c += 1
			continue
		if y == 0:
			a[0, 1] = a.get((0, 1), 0) + 1
			continue
		if x == 0:
			b[0, 1] = b.get((0, 1), 0) + 1
		g = math.gcd(x, y)
		if x * y > 0:
			x = abs(x)
			y = abs(y)
			a[x // g, y // g] = a.get((x // g, y // g), 0) + 1
		else:
			x = abs(x)
			y = abs(y)
			b[y // g, x // g] = b.get((y // g, x // g), 0) + 1
	ans = 1
	s = 0
	for (k, v) in list(a.items()):
		if k in b:
			s += v + b[k]
			ans *= pow(2, v) + pow(2, b[k]) - 1
			ans %= mod
	ans *= pow(2, n - s - c, mod)
	print((ans - 1 + c) % mod)
main()


from collections import defaultdict
from math import gcd
import sys
MOD = 10 ** 9 + 7
N = int(input())
sar = defaultdict(int)
zero = 0
for s in sys.stdin.readlines():
	(A, B) = map(int, s.split())
	if (A, B) == (0, 0):
		zero += 1
	else:
		a = abs(A)
		b = abs(B)
		x = gcd(a, b)
		if a == 0:
			sar[0, b // x, 1] += 1
		elif b == 0:
			sar[a // x, 0, 0] += 1
		else:
			sar[a // x, b // x, int((A >= 0) ^ (B >= 0))] += 1
ans = 1
done = set()
for k in list(sar.keys()):
	(a, b, c) = k
	if (a, b, c) not in done:
		cnt = pow(2, sar[a, b, c], MOD) + pow(2, sar[b, a, c ^ 1], MOD) - 1
		ans *= cnt
		ans %= MOD
		done.add((a, b, c))
		done.add((b, a, c ^ 1))
ans -= 1
ans += zero
print(ans % MOD)


import functools
MOD = 10 ** 9 + 7

def euclid(a, b):
	if b == 0:
		return a
	else:
		return euclid(b, a % b)

def gcd(nums):
	return functools.reduce(euclid, nums)
n = int(input())
t = []
for i in range(n):
	(a, b) = map(int, input().split())
	t.append((a, b))
z = 0
y = {}
for i in range(n):
	if t[i][0] == 0 and t[i][1] == 0:
		z += 1
	else:
		g = abs(gcd([t[i][0], t[i][1]]))
		if t[i][1] == 0:
			a = (1, 0)
		elif t[i][1] > 0:
			a = (t[i][0] // g, t[i][1] // g)
		else:
			a = (-t[i][0] // g, -t[i][1] // g)
		if a not in y:
			y[a] = 1
		else:
			y[a] += 1
cnt = 0
x = 1
for i in y:
	if (-i[1], i[0]) in y:
		x *= pow(2, y[-i[1], i[0]], MOD) + pow(2, y[i[0], i[1]], MOD) - 1
		cnt += y[-i[1], i[0]] + y[i[0], i[1]]
ans = pow(2, n - z - cnt, MOD) * x - 1
print((ans + z) % MOD)


import math
mod = 10 ** 9 + 7
N = int(input())
iwashi01 = 0
iwashi10 = 0
iwashi00 = 0
iwashi = dict()
for i in range(N):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		iwashi00 += 1
	elif a == 0:
		iwashi01 += 1
	elif b == 0:
		iwashi10 += 1
	else:
		g = math.gcd(abs(a), abs(b))
		a //= g
		b //= g
		if a * b > 0:
			if a < 0 and b < 0:
				a *= -1
				b *= -1
			iwashi.setdefault((a, b), [0, 0])
			iwashi[a, b][0] += 1
		if a * b < 0:
			if a < 0 and b > 0:
				a *= -1
				b *= -1
			(a, b) = (-b, a)
			iwashi.setdefault((a, b), [0, 0])
			iwashi[a, b][1] += 1
r = 2 ** iwashi01 % mod - 1 + 2 ** iwashi10 % mod - 1 + 1
for (s, t) in iwashi.values():
	r *= 2 ** s % mod - 1 + 2 ** t % mod - 1 + 1
	r %= mod
print((r + iwashi00 - 1) % mod)


import sys
input = lambda : sys.stdin.readline().rstrip()
from collections import defaultdict
P = 7 ** 21 + 52
mod = 10 ** 9 + 7
N = int(input())
D = defaultdict(int)
C00 = 0
for i in range(N):
	(a, b) = map(int, input().split())
	if a == b == 0:
		C00 += 1
	elif a == 0:
		D[-1] += 1
	elif b == 0:
		D[-2] += 1
	else:
		x = a * pow(b, P - 2, P) % P
		D[x] += 1
ans = 1
for x in D:
	y = pow(-x, P - 2, P) if x > 0 else -3 - x
	if y in D and x > y:
		continue
	ans *= 1 + pow(2, D[x], mod) - 1 + pow(2, D[y] if y in D else 0, mod) - 1
	ans %= mod
print((ans + C00 - 1) % mod)


from collections import defaultdict
from math import gcd
N = int(input())
MOD = 10 ** 9 + 7
L = defaultdict(lambda : [0, 0])
zero = 0
for _ in range(N):
	(A, B) = map(int, input().split())
	if A == 0:
		d = B
	elif B == 0:
		d = A
	else:
		d = gcd(A, B)
	if d != 0:
		(A, B) = (A // d, B // d)
		if A < 0:
			(A, B) = (-A, -B)
		if B > 0:
			L[A, B][0] += 1
		else:
			L[-B, A][1] += 1
	else:
		zero += 1
res = 1
for (x, y) in L.values():
	res *= pow(2, x, MOD) + pow(2, y, MOD) - 1
	res %= MOD
print((res + zero - 1) % MOD)


import sys
sys.setrecursionlimit(10 ** 7)
from pprint import pprint as pp
from pprint import pformat as pf
import math
import bisect
from fractions import Fraction
from collections import defaultdict

def is_same_sign(a, b):
	if a > 0 and b > 0:
		return True
	if a < 0 and b < 0:
		return True
	return False

def fraction_taple(a, b):
	g = math.gcd(a, b)
	if is_same_sign(a, b):
		s = 1
	else:
		s = -1
	a = abs(a) // g
	b = abs(b) // g
	return (s, a, b)

def mode(a, b):
	if a == 0 and b == 0:
		return (0, 0)
	if a == 0:
		return ('ab', 0)
	if b == 0:
		return ('ab', 1)
	x = fraction_taple(a, b)
	y = fraction_taple(-1 * b, a)
	if x > y:
		return (x, 0)
	else:
		return (y, 1)
MOD = 1000000007

def __starting_point():
	n = int(input())
	d = defaultdict(lambda : [0, 0])
	zero = 0
	for _ in range(n):
		(a, b) = list(map(int, input().split()))
		(dkey, akey) = mode(a, b)
		if dkey == 0:
			zero += 1
		else:
			d[dkey][akey] += 1
	ans = 1
	for pair in list(d.values()):
		tmp = pow(2, pair[0], MOD) - 1 + pow(2, pair[1], MOD) - 1 + 1
		ans *= tmp
	ans += zero - 1
	ans %= MOD
	print(ans)
__starting_point()


from math import gcd
MOD = 1000000007

def inv(a, b):
	if a < 0:
		(a, b) = (-a, -b)
	return (-b, a)

def solve(n, a, b):
	zero_zero = 0
	zero = 0
	inf = 0
	D = {}
	for i in range(n):
		(p, q) = (a[i], b[i])
		if p == 0 and q == 0:
			zero_zero += 1
		elif p == 0:
			zero += 1
		elif q == 0:
			inf += 1
		else:
			r = gcd(p, q)
			(p, q) = (p // r, q // r)
			if q < 0:
				(p, q) = (-p, -q)
			k = (p, q)
			if not k in D:
				D[k] = 0
			D[k] += 1
	group = set()
	for ((p, q), v) in D.items():
		if not inv(p, q) in group:
			group.add((p, q))
	pow2 = [0] * (n + 1)
	pow2[0] = 1
	for i in range(n):
		pow2[i + 1] = pow2[i] * 2 % MOD
	ans = 1
	for (p, q) in group:
		t = pow2[D[p, q]]
		if inv(p, q) in D:
			t += pow2[D[inv(p, q)]] - 1
		ans = ans * t % MOD
	ans *= pow2[zero] + pow2[inf] - 1
	return (ans + zero_zero - 1) % MOD
n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
	(a[i], b[i]) = map(int, input().split())
print(solve(n, a, b))


mod = 10 ** 9 + 7
from math import gcd
from collections import defaultdict
n = int(input())
ab = [list(map(int, input().split())) for i in range(n)]
ans = 0
d = defaultdict(int)
s = set()
for (a, b) in ab:
	if a == 0 and b == 0:
		ans += 1
		continue
	if a == 0:
		b = 1
		x = 1
		y = 0
	elif b == 0:
		a = 1
		x = 0
		y = 1
	else:
		g = gcd(abs(a), abs(b))
		a //= g
		b //= g
		if a < 0:
			a = -a
			b = -b
		x = b
		y = -a
		if x < 0:
			x = -x
			y = -y
	d[a, b] += 1
	k = tuple(sorted([(a, b), (x, y)]))
	s.add(k)
s = list(s)
n = len(s)
if n == 0:
	print(ans)
	exit()
DP = [0] * (n + 1)
DP[0] = 1
for i in range(n):
	(l, r) = s[i]
	DP[i + 1] = DP[i] * (1 + pow(2, d[l], mod) - 1 + pow(2, d[r], mod) - 1)
	DP[i + 1] %= mod
ans += DP[-1] - 1
ans %= mod
print(ans)


import math
import collections
N = int(input())
count_both = 0
count = collections.defaultdict(lambda : [0] * 2)
for _ in range(N):
	(a, b) = [int(x) for x in input().split(' ')]
	if a == 0 and b == 0:
		count_both += 1
		continue
	if a == 0:
		count[1, 0][0] += 1
		continue
	if b == 0:
		count[1, 0][1] += 1
		continue
	s = math.copysign(1, a * b)
	a = abs(a)
	b = abs(b)
	g = math.gcd(a, b)
	if s > 0:
		count[a // g, b // g][0] += 1
	else:
		count[b // g, a // g][1] += 1
ans = 1
for (_, p) in count.items():
	ans *= 2 ** p[0] + 2 ** p[1] - 1
	ans %= 1000000007
ans += count_both + 1000000007 - 1
ans %= 1000000007
print(ans)


import math
from collections import Counter
MOD = 10 ** 9 + 7
N = int(input())
I = []
zz = 0
sz = 0
tz = 0
for _ in range(N):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zz += 1
		continue
	if a == 0:
		sz += 1
		continue
	if b == 0:
		tz += 1
		continue
	gcd = math.gcd(a, b)
	if b < 0:
		a *= -1
		b *= -1
	I.append((a // gcd, b // gcd))
S = []
T = []
C = Counter(I)
for (a, b) in C.keys():
	if a > 0:
		S.append(C[a, b])
		T.append(C[-b, a])
	elif C[b, -a] == 0:
		S.append(0)
		T.append(C[a, b])
ans = 1
ans *= 2 ** sz + 2 ** tz - 1
ans %= MOD
for i in range(len(S)):
	ans *= 2 ** S[i] + 2 ** T[i] - 1
	ans %= MOD
ans += zz
ans -= 1
print(ans % MOD)


import math
n = int(input())
d = dict()
for i in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		pass
	elif a == 0:
		(a, b) = (0, 1)
	elif b == 0:
		(a, b) = (1, 0)
	else:
		x = math.gcd(abs(a), abs(b))
		(a, b) = (a // x, b // x)
		if a < 0:
			(a, b) = (-a, -b)
	if (a, b) in d:
		d[a, b] += 1
	else:
		d[a, b] = 1
(ans1, ans2) = (1, 0)
for i in d:
	if d[i] == 0:
		continue
	if i == (0, 0):
		ans2 = d[i]
		d[i] = 0
		continue
	(a, b) = i
	if (-b, a) in d:
		ans1 *= 2 ** d[i] + 2 ** d[-b, a] - 1
		d[-b, a] = 0
		d[i] = 0
	elif (b, -a) in d:
		ans1 *= 2 ** d[i] + 2 ** d[b, -a] - 1
		d[b, -a] = 0
		d[i] = 0
	else:
		ans1 *= 2 ** d[i]
		d[i] = 0
print((ans1 + ans2 - 1) % (10 ** 9 + 7))


from math import gcd
from collections import Counter
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10 ** 9 + 7

def main():
	(N, *ab) = list(map(int, read().split()))
	ab_zero = 0
	ratio = []
	for (a, b) in zip(*[iter(ab)] * 2):
		if a == 0 and b == 0:
			ab_zero += 1
		else:
			if b < 0:
				(a, b) = (-a, -b)
			if b == 0:
				a = 1
			g = gcd(a, b)
			a //= g
			b //= g
			ratio.append((a, b))
	s = Counter(ratio)
	bad = 1
	no_pair = 0
	for (k, v) in list(s.items()):
		(a, b) = k
		if a > 0:
			if (-b, a) in s:
				bad *= pow(2, v, MOD) + pow(2, s[-b, a], MOD) - 1
				bad %= MOD
			else:
				no_pair += v
		elif (b, -a) not in s:
			no_pair += v
	bad *= pow(2, no_pair, MOD)
	bad %= MOD
	ans = (bad + ab_zero - 1) % MOD
	print(ans)

def __starting_point():
	main()
__starting_point()


n = int(input())
mod = 1000000007
import math
ab = []
n0 = 0
for i in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		n0 += 1
		continue
	if b == 0:
		ab.append((1, 0))
	elif a == 0:
		ab.append((0, 1))
	else:
		gc = math.gcd(a, b) * b // abs(b)
		ab.append((a // gc, b // gc))
n_eff = n - n0
from collections import Counter
c = Counter(ab)
pairs = []
for cc in c:
	n_dual = c[-cc[1], cc[0]]
	if n_dual > 0:
		pairs.append((c[cc], n_dual))
ans = 1
for p in pairs:
	ans = ans * (pow(2, p[0], mod) + pow(2, p[1], mod) - 1) % mod
amari = n_eff - sum((sum(p) for p in pairs))
ans = ans * pow(2, amari, mod) % mod
ans = ans + n0 - 1
print(ans % mod)


from math import gcd
from collections import defaultdict
N = int(input())
mod = 10 ** 9 + 7
d_1 = defaultdict(int)
d_2 = defaultdict(int)
zeros = 0

def to_irreducible(a, b):
	GCD = gcd(a, b)
	return list(map(lambda x: x // GCD, [a, b]))
for i in range(N):
	(a, b) = map(int, input().split(' '))
	if a == b == 0:
		zeros += 1
	elif a * b >= 0 and b != 0:
		(a, b) = to_irreducible(abs(a), abs(b))
		d_1[a, b] += 1
	else:
		(a, b) = to_irreducible(abs(b), abs(a))
		d_1[a, b] += 0
		d_2[a, b] += 1
ans = 1
for (k, v_1) in d_1.items():
	v_2 = d_2[k]
	ans *= pow(2, v_1, mod) + pow(2, v_2, mod) - 1
	ans %= mod
print((ans + zeros - 1) % mod)


import math
n = int(input())
mod = 10 ** 9 + 7
ab = {}
for i in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		pass
	elif a == 0:
		b = 1
	else:
		gcd = math.gcd(a, b)
		a //= gcd
		b //= gcd
		if a < 0:
			(a, b) = (-a, -b)
	num = (a, b)
	ab.setdefault(num, 0)
	ab[num] += 1
ans = 0
if (0, 0) in ab.keys():
	temp2 = ab[0, 0]
	ans += temp2
	n -= temp2
s = set(ab.keys())
pairs = []
for i in ab.keys():
	if i == (0, 0):
		continue
	else:
		(a, b) = (i[0], i[1])
		if (-b, a) in s:
			pairs.append([ab[a, b], ab[-b, a]])
temp3 = 1
for i in range(len(pairs)):
	num2 = pairs[i][0]
	num3 = pairs[i][1]
	temp3 *= pow(2, num2, mod) + pow(2, num3, mod) - 1
	n = n - num2 - num3
	temp3 %= mod
temp3 *= pow(2, n, mod)
temp3 -= 1
temp3 %= mod
ans += temp3
ans %= mod
print(ans)


from math import gcd
from collections import defaultdict
MOD = 10 ** 9 + 7
N = int(input())
d = defaultdict(int)
zero = [0, 0, 0]
for i in range(N):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zero[0] += 1
		continue
	if a == 0:
		zero[1] += 1
		continue
	if b == 0:
		zero[2] += 1
		continue
	s = -1 if a * b < 0 else 1
	g = gcd(a, b)
	a //= g
	b //= g
	d[s, abs(a), abs(b)] += 1
ans = 1
for ((s, a, b), c1) in d.items():
	if c1 == 0:
		continue
	k = (-s, b, a)
	if k in d:
		c2 = d[k]
		ans *= pow(2, c1, MOD) + pow(2, c2, MOD) - 1
		ans %= MOD
		d[k] = 0
	else:
		ans *= pow(2, c1, MOD)
		ans %= MOD
ans *= pow(2, zero[1], MOD) + pow(2, zero[2], MOD) - 1
ans %= MOD
ans += zero[0]
ans -= 1
ans %= MOD
print(ans)


import sys
readline = sys.stdin.readline
read = sys.stdin.read
(n, *ab) = [int(i) for i in read().split()]
M = iter(ab)
d = {}
zero = 0
from math import gcd
for (a, b) in zip(M, M):
	if a == b == 0:
		zero += 1
		continue
	g = gcd(a, b)
	a //= g
	b //= g
	if b < 0:
		a = -a
		b = -b
	if b == 0 and a == -1:
		a = 1
	if a > 0:
		if (a, b) in d:
			d[a, b][0] += 1
		else:
			d[a, b] = [1, 0]
	elif (b, -a) in d:
		d[b, -a][1] += 1
	else:
		d[b, -a] = [0, 1]
MOD = 1000000007
ans = 1
pow2 = [1]
for _ in range(200005):
	pow2.append(pow2[-1] * 2 % MOD)
for ((a, b), (k, l)) in d.items():
	ans *= pow2[k] + pow2[l] - 1
	ans %= MOD
ans += zero - 1
print(ans % MOD)


def main():
	import sys
	sys.setrecursionlimit(10 ** 9)
	input = sys.stdin.readline
	import math
	from collections import defaultdict
	mod = 1000000007
	N = int(input())
	zero_pair = 0
	zero_a = 0
	zero_b = 0
	pair_plus = defaultdict(int)
	pair_minus = defaultdict(int)
	for (a, b) in [tuple(map(int, input().split())) for _ in range(N)]:
		if a == 0 and b == 0:
			zero_pair += 1
			continue
		if a == 0:
			zero_a += 1
			continue
		if b == 0:
			zero_b += 1
			continue
		abs_a = abs(a)
		abs_b = abs(b)
		g = math.gcd(abs_a, abs_b)
		abs_a = abs_a // g
		abs_b = abs_b // g
		if a * b > 0:
			pair_plus[abs_a, abs_b] += 1
		else:
			pair_minus[abs_a, abs_b] += 1
	ans = 1
	ans *= (pow(2, zero_a, mod) + pow(2, zero_b, mod) - 1) % mod
	ans %= mod
	count_all = 0
	for item in list(pair_plus.items()):
		(a, b) = item[0]
		cnt = item[1]
		if (b, a) in pair_minus:
			ans *= (pow(2, cnt, mod) + pow(2, pair_minus[b, a]) - 1) % mod
			ans %= mod
			del pair_minus[b, a]
		else:
			count_all += cnt
	for val in list(pair_minus.values()):
		count_all += val
	ans = ans * pow(2, count_all, mod) % mod
	ans += zero_pair
	print((ans - 1) % mod)
main()


from math import gcd
MOD = 1000000007
N = int(input())
Fish = {}
zeros = 0
for i in range(N):
	(A, B) = list(map(int, input().split()))
	if A == 0 and B == 0:
		zeros += 1
		continue
	G = gcd(abs(A), abs(B))
	(A, B) = (A // G, B // G)
	if A < 0:
		A *= -1
		B *= -1
	elif A == 0:
		B = 1
	if (A, B) not in Fish:
		Fish[A, B] = 1
	else:
		Fish[A, B] += 1
done_set = set()
ans = 1
for (a, b) in list(Fish.keys()):
	if b > 0:
		c = b
		d = -a
	elif b == 0:
		c = 0
		d = 1
	else:
		(c, d) = (-b, a)
	if (a, b) in done_set or (c, d) in done_set:
		continue
	if (c, d) not in list(Fish.keys()):
		ans *= pow(2, Fish[a, b], MOD)
	else:
		ans *= 1 + (pow(2, Fish[a, b], MOD) - 1) + (pow(2, Fish[c, d], MOD) - 1)
		done_set.add((c, d))
	ans %= MOD
	done_set.add((a, b))
ans += zeros
ans -= 1
ans %= MOD
print(ans)


import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
p = 10 ** 9 + 7
from math import gcd
from collections import Counter
from collections import defaultdict
used = defaultdict(list)
n = int(input())
ctr = Counter()
az = bz = zz = 0
for i in range(n):
	(a, b) = list(map(int, input().split()))
	if a == b == 0:
		zz += 1
	elif a == 0:
		az += 1
	elif b == 0:
		bz += 1
	else:
		g = gcd(a, b)
		(a, b) = (a // g, b // g)
		if b < 0:
			a *= -1
			b *= -1
		ctr[a, b] += 1
		used[a, b] = False
ans = 1
for ((a1, b1), v1) in list(ctr.items()):
	if used[a1, b1]:
		continue
	(a2, b2) = (-b1, a1)
	if b2 < 0:
		b2 *= -1
		a2 *= -1
	v2 = ctr[a2, b2]
	r = (pow(2, v1, p) + pow(2, v2, p) - 1) % p
	ans *= r
	ans %= p
	used[a1, b1] = True
	used[a2, b2] = True
r = (pow(2, az, p) + pow(2, bz, p) - 1) % p
ans *= r
ans %= p
ans += zz
ans -= 1
ans %= p
print(ans)


from collections import Counter
from fractions import Fraction
MOD = 10 ** 9 + 7
N = int(input())
ct = Counter()
Azero = 0
Bzero = 0
Allzero = 0
for _ in range(N):
	(a, b) = map(int, input().split())
	if a == b == 0:
		Allzero += 1
	elif a == 0:
		Azero += 1
	elif b == 0:
		Bzero += 1
	else:
		f = Fraction(a, b)
		ct[f.numerator, f.denominator] += 1
ans = pow(2, Azero, MOD) + pow(2, Bzero, MOD) - 1
ans %= MOD
visited = set()
for (a, b) in ct.keys():
	if (a, b) in visited:
		continue
	inv = Fraction(-b, a)
	(ia, ib) = (inv.numerator, inv.denominator)
	visited.add((a, b))
	visited.add((ia, ib))
	tmp = pow(2, ct[a, b], MOD) + pow(2, ct[ia, ib], MOD) - 1
	ans *= tmp
	ans %= MOD
ans += Allzero
print((ans - 1) % MOD)


from collections import defaultdict
from math import gcd
MOD = 1000000007
inpl = lambda : list(map(int, input().split()))
groups = defaultdict(int)
null = 0
N = int(input())
for _ in range(N):
	(A, B) = inpl()
	if A == 0 and B == 0:
		null += 1
	elif A == 0:
		groups[0, 1] += 1
	elif B == 0:
		groups[1, 0] += 1
	else:
		g = gcd(A, B)
		A //= g
		B //= g
		if A < 0:
			A *= -1
			B *= -1
		groups[A, B] += 1
ans = 1
for k in list(groups.keys()):
	(A, B) = k
	if B <= 0:
		(C, D) = (-B, A)
	else:
		(C, D) = (B, -A)
	groups[C, D]
for (k, v) in groups.items():
	(A, B) = k
	if B <= 0:
		continue
	u = groups[B, -A]
	p = pow(2, v, MOD) + pow(2, u, MOD) - 1
	ans *= p
	ans %= MOD
ans -= 1
ans += null
print(ans % MOD)


import sys, os
if 'local' in os.environ:
	sys.stdin = open('./input.txt', 'r')
f = lambda : list(map(int, input().split()))

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

def quick_pow(x, n, mod):
	ans = 1
	while n:
		if n & 1:
			ans *= x
			ans %= mod
		x *= x
		x %= mod
		n >>= 1
	return ans

def solve():
	mod = 1000000007
	n = f()[0]
	dirs = {}
	all0 = 0
	x0 = 0
	y0 = 0
	for _ in range(n):
		(a, b) = f()
		if a == 0 and b == 0:
			all0 += 1
			continue
		if a == 0:
			x0 += 1
			continue
		if b == 0:
			y0 += 1
			continue
		if a < 0:
			a = -a
			b = -b
		g = gcd(abs(a), abs(b))
		a //= g
		b //= g
		if a * b > 0:
			if (a, b) not in dirs:
				dirs[a, b] = {}
				dirs[a, b][0] = 0
				dirs[a, b][1] = 0
			dirs[a, b][0] = dirs[a, b][0] + 1
		else:
			if (-b, a) not in dirs:
				dirs[-b, a] = {}
				dirs[-b, a][0] = 0
				dirs[-b, a][1] = 0
			dirs[-b, a][1] = dirs[-b, a][1] + 1
	ans = 1
	ans *= (quick_pow(2, x0, mod) + quick_pow(2, y0, mod) - 1 + mod) % mod
	ans %= mod
	for (_, l) in list(dirs.items()):
		ans *= (quick_pow(2, l[0], mod) + quick_pow(2, l[1], mod) - 1 + mod) % mod
		ans %= mod
	ans -= 1
	if all0:
		ans += all0
	ans += mod
	ans %= mod
	print(ans)
solve()


import math
MOD = 1000000007
N = int(input())
d_p = dict()
d_m = dict()
ans = 1
zz = 0
for n in range(N):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zz += 1
		continue
	if a == 0:
		n_sign = 0
		b = 0
	elif b == 0:
		n_sign = 1
		a = 0
	else:
		n_sign = ((a < 0) + (b < 0)) % 2
		a = abs(a)
		b = abs(b)
		gcd = math.gcd(a, b)
		a //= gcd
		b //= gcd
	if n_sign == 1:
		s = str(b) + '/' + str(a)
		d_m[s] = d_m.get(s, 0) + 1
	elif n_sign == 0:
		s = str(a) + '/' + str(b)
		d_p[s] = d_p.get(s, 0) + 1
for (k, v) in d_m.items():
	if k in d_p:
		ans *= 2 ** v + 2 ** d_p[k] - 1
		d_p.pop(k)
	else:
		ans *= 2 ** v
	ans %= MOD
for (k, v) in d_p.items():
	ans *= 2 ** v
	ans %= MOD
ans -= 1
ans += zz
ans %= MOD
print(ans)


import math
MOD = 1000000007

def normalize(p):
	if p[0] == 0:
		return (0, 1)
	if p[1] == 0:
		return (1, 0)
	if p[0] < 0:
		p = (-p[0], -p[1])
	g = math.gcd(p[0], abs(p[1]))
	return (p[0] // g, p[1] // g)

def enemy(p):
	return normalize((-p[1], p[0]))
n = int(input())
solo = 0
groups = dict()
for _ in range(n):
	(x, y) = map(int, input().split())
	if x == 0 and y == 0:
		solo += 1
	else:
		p = normalize((x, y))
		groups[p] = groups.get(p, 0) + 1
ans = 1
done = set()
for p in groups:
	q = enemy(p)
	if p in done or q in done:
		continue
	(pcnt, qcnt) = (groups[p], groups.get(q, 0))
	mul = pow(2, pcnt, MOD) + pow(2, qcnt, MOD) + MOD - 1
	ans = ans * mul % MOD
	done.add(p)
	done.add(q)
ans = (ans + solo + MOD - 1) % MOD
print(ans)


from math import gcd
import sys
input = sys.stdin.readline
n = int(input())
dic = {}
z = 0
mod = 10 ** 9 + 7
for i in range(n):
	(a, b) = map(int, input().split())
	if a == b == 0:
		z += 1
		continue
	k = gcd(a, b)
	a //= k
	b //= k
	if b < 0:
		a = -a
		b = -b
	if b == 0 and a < 0:
		a = -a
	if a <= 0:
		(a, b) = (b, -a)
		if (a, b) in dic:
			dic[a, b][0] += 1
		else:
			dic[a, b] = [1, 0]
	elif (a, b) in dic:
		dic[a, b][1] += 1
	else:
		dic[a, b] = [0, 1]
ans = 1
for x in dic:
	v = dic[x]
	s = v[0]
	t = v[1]
	ans *= pow(2, s, mod) + pow(2, t, mod) - 1
	ans %= mod
print((z - 1 + ans) % mod)


from math import gcd
n = int(input())
p = 10 ** 9 + 7
iwashi = {}
bad = 0
ans = 1
for i in range(n):
	(x, y) = list(map(int, input().split()))
	if x == 0 and y == 0:
		bad += 1
		continue
	elif x == 0:
		try:
			iwashi[0, 1] += 1
		except KeyError:
			iwashi[0, 1] = 1
			continue
	elif y == 0:
		try:
			iwashi[1, 0] += 1
		except KeyError:
			iwashi[1, 0] = 1
		continue
	else:
		g = gcd(x, y)
		(x, y) = (x // g, y // g)
		if x < 0:
			(x, y) = (-x, -y)
		try:
			iwashi[x, y] += 1
		except KeyError:
			iwashi[x, y] = 1
for (x, y) in iwashi:
	a = iwashi[x, y]
	if y > 0:
		(rx, ry) = (y, -x)
	else:
		(rx, ry) = (-y, x)
	try:
		b = iwashi[rx, ry]
		iwashi[rx, ry] = 0
	except KeyError:
		b = 0
	ans *= pow(2, a, p) + pow(2, b, p) - 1
	ans %= p
	iwashi[x, y] = 0
print((ans + bad - 1) % p)


from collections import defaultdict
from itertools import groupby, accumulate, product, permutations, combinations
from math import gcd

def reduction(x, y):
	g = gcd(x, y)
	return (abs(x) // g, abs(y) // g)

def solve():
	mod = 10 ** 9 + 7
	dplus = defaultdict(lambda : 0)
	dminus = defaultdict(lambda : 0)
	N = int(input())
	(x0, y0, xy0) = (0, 0, 0)
	for i in range(N):
		(x, y) = map(int, input().split())
		if x == 0 and y == 0:
			xy0 += 1
		elif x == 0 and y != 0:
			x0 += 1
		elif y == 0:
			y0 += 1
		elif x * y > 0:
			dplus[reduction(x, y)] += 1
		else:
			dminus[reduction(-y, x)] += 1
	ans = pow(2, x0, mod) + pow(2, y0, mod) - 1
	other = N - x0 - y0 - xy0
	for (k, v) in dplus.items():
		ans *= pow(2, dminus[k], mod) + pow(2, v, mod) - 1
		other -= dminus[k] + v
	ans *= pow(2, other, mod)
	ans += xy0 - 1
	ans %= mod
	return ans
print(solve())


import math
import sys
from collections import defaultdict
input = sys.stdin.readline
mod = 1000000007
n = int(input())
n2 = [1]
for _ in range(n):
	n2.append(n2[-1] * 2 % mod)
zero = 0
plus = defaultdict(int)
minus = defaultdict(int)
for _ in range(n):
	(a, b) = map(int, input().split())
	if a == 0 and b == 0:
		zero += 1
		continue
	elif a == 0:
		plus[1, 0] += 1
	elif b == 0:
		minus[1, 0] += 1
	else:
		p = math.gcd(a, b)
		a //= p
		b //= p
		if a * b > 0:
			plus[abs(a), abs(b)] += 1
		else:
			minus[abs(b), abs(a)] += 1
n -= zero
ans = 1
for (k, v) in plus.items():
	if minus[k] > 0:
		ans *= n2[v] + n2[minus[k]] - 1
		ans %= mod
		n -= v + minus[k]
ans *= n2[n]
ans %= mod
ans += zero - 1
ans %= mod
print(ans)


import math
from collections import defaultdict
p = 10 ** 9 + 7
n = int(input())
dict = defaultdict(int)
for i in range(n):
	(a, b) = [int(x) for x in input().split()]
	if a == 0 and b == 0:
		pass
	elif a == 0:
		b = -1
	else:
		d = a // abs(a) * math.gcd(a, b)
		a = a // d
		b = b // d
	dict[a, b] += 1
bad = []
others = []
zeros = 0
for (a, b) in dict:
	if dict[a, b] == 0:
		continue
	if a == 0 and b == 0:
		zeros += dict[a, b]
		dict[a, b] = 0
	elif (b, -a) in dict:
		bad.append((dict[a, b], dict[b, -a]))
	elif (-b, a) in dict:
		pass
	else:
		others.append(dict[a, b])
ans = 1
for (x, y) in bad:
	ans = ans * (pow(2, x, p) + pow(2, y, p) - 1) % p
for z in others:
	ans = ans * pow(2, z, p) % p
ans = (ans + zeros - 1) % p
print(ans)


from math import gcd
from collections import defaultdict
n = int(input())
(a, b) = ([], [])
for i in range(n):
	data = list(map(int, input().split()))
	a.append(data[0])
	b.append(data[1])
d = defaultdict(lambda : [0, 0])
zeros = 0
for i in range(n):
	if a[i] * b[i] != 0:
		g = gcd(a[i], b[i])
		a[i] //= g
		b[i] //= g
	if a[i] * b[i] > 0:
		d[abs(a[i]), abs(b[i])][0] += 1
	elif a[i] * b[i] < 0:
		d[abs(b[i]), abs(a[i])][1] += 1
	elif a[i] == 0 and b[i] != 0:
		d[0, 1][0] += 1
	elif b[i] == 0 and a[i] != 0:
		d[0, 1][1] += 1
	elif a[i] == b[i] == 0:
		zeros += 1
mod = 1000000007
cnt = 1
for pair in d.values():
	cnt *= pow(2, pair[0], mod) + pow(2, pair[1], mod) - 1
	cnt %= mod
cnt += zeros - 1
cnt %= mod
print(cnt)


mod = 1000000007
n = int(input())
ab00 = 0
abx0 = 0
ab0x = 0
p = []
m = []
from math import gcd
for _ in range(n):
	(i, j) = map(int, input().split())
	if i == 0:
		if j == 0:
			ab00 += 1
		else:
			ab0x += 1
		continue
	elif j == 0:
		abx0 += 1
		continue
	k = gcd(i, j)
	i //= k
	j //= k
	if i > 0:
		if j > 0:
			p.append((i, j))
		else:
			m.append((-j, i))
	elif j > 0:
		m.append((j, -i))
	else:
		p.append((-i, -j))
m.sort()
p.sort()
ans = pow(2, ab0x, mod) + pow(2, abx0, mod) - 1
ans %= mod
mi = 0
pi = 0
while mi < len(m) and pi < len(p):
	if m[mi] == p[pi]:
		mi += 1
		mnum = 1
		while mi < len(m) and m[mi] == m[mi - 1]:
			mi += 1
			mnum += 1
		pi += 1
		pnum = 1
		while pi < len(p) and p[pi] == p[pi - 1]:
			pi += 1
			pnum += 1
		ans *= pow(2, mnum, mod) + pow(2, pnum, mod) - 1
		ans %= mod
	elif m[mi] < p[pi]:
		mi += 1
		mnum = 1
		while mi < len(m) and m[mi] < p[pi]:
			mi += 1
			mnum += 1
		ans *= pow(2, mnum, mod)
		ans %= mod
	else:
		pi += 1
		pnum = 1
		while pi < len(p) and p[pi] < m[mi]:
			pi += 1
			pnum += 1
		ans *= pow(2, pnum, mod)
		ans %= mod
ans *= pow(2, len(p) - pi, mod)
ans %= mod
ans *= pow(2, len(m) - mi, mod)
ans %= mod
ans = (ans - 1 + ab00) % mod
print(ans)


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def xy(x, y):
	(x, y) = (abs(x), abs(y))
	g = gcd(x, y)
	x //= g
	y //= g
	return 10 ** 20 * x + y
from collections import defaultdict
mod = 10 ** 9 + 7
n = int(input())
aabb = [list(map(int, input().split())) for _ in range(n)]
ab = []
ans = 0
for i in aabb:
	if i != [0, 0]:
		ab.append(i)
	else:
		n -= 1
		ans += 1
az = bz = 0
d = defaultdict(int)
dd = defaultdict(int)
for i in ab:
	if 0 in i:
		if i[0] == 0:
			az += 1
		else:
			bz += 1
	else:
		(a, b) = i
		if a * b > 0:
			d[xy(a, b)] += 1
		else:
			dd[xy(a, b)] += 1
t = []
tt = 1
for i in dd:
	(b, a) = divmod(i, 10 ** 20)
	(p, m) = (d[xy(a, b)], dd[i])
	if p * m:
		n -= p + m
		tt *= pow(2, p, mod) + pow(2, m, mod) - 1
		tt %= mod
if az * bz:
	n -= az + bz
	tt *= pow(2, az, mod) + pow(2, bz, mod) - 1
	tt %= mod
ans += (tt * pow(2, n, mod) - 1) % mod
print(ans % mod)


n = int(input())
ab = []
for _ in range(n):
	(a, b) = map(int, input().split())
	ab.append((a, b))
di = {}
z = 0

def gcd(a, b):
	while b != 0:
		(a, b) = (b, a % b)
	return a
for (a, b) in ab:
	if a * b != 0:
		g = gcd(abs(a), abs(b))
		(a, b) = (a // g, b // g)
	if a * b > 0:
		ind = (abs(a), abs(b))
	elif a * b < 0:
		ind = (abs(b), abs(a))
	else:
		ind = 0
	if ind in di:
		(x, y) = di[ind]
	else:
		x = y = 0
	if a * b == 0:
		if b != 0:
			di[ind] = (x + 1, y)
		elif a != 0:
			di[ind] = (x, y + 1)
		else:
			z += 1
	elif a * b > 0:
		di[ind] = (x + 1, y)
	else:
		di[ind] = (x, y + 1)
mod = 10 ** 9 + 7
ans = 1
for (i, j) in di.values():
	ans *= pow(2, i, mod) + pow(2, j, mod) - 1
	ans %= mod
print((ans + z - 1) % mod)


import math, collections
N = int(input())
AB = [[int(_) for _ in input().split()] for _ in range(N)]
mod = 10 ** 9 + 7
C = collections.Counter()
gcd = math.gcd
a0 = 0
for (a, b) in AB:
	if a == b == 0:
		a0 += 1
	elif a == 0:
		C[0, -1] += 1
	else:
		g = gcd(a, b)
		a //= g
		b //= g
		if a < 0:
			a *= -1
			b *= -1
		C[a, b] += 1
ans = 1
for (a, b) in C:
	if C[b, -a]:
		continue
	elif C[-b, a]:
		ans *= (pow(2, C[a, b], mod) + pow(2, C[-b, a], mod) - 1) % mod
		ans %= mod
	else:
		ans *= pow(2, C[a, b], mod)
		ans %= mod
ans += a0 - 1
ans %= mod
print(ans)


from collections import Counter
import sys
input = sys.stdin.buffer.readline
N = int(input())

def gcd(n, m):
	if m == 0:
		return n
	return gcd(m, n % m)

def make(a, b):
	if a == b == 0:
		return (0, 0, 0)
	if a == 0:
		return (0, 1, 0)
	if b == 0:
		return (1, 0, 0)
	s = 1 if a * b > 0 else -1
	(a, b) = (abs(a), abs(b))
	g = gcd(a, b)
	a //= g
	b //= g
	return (a, b, s)
ABS = Counter([make(*map(int, input().split())) for _ in range(N)])
ans = 1
MOD = 10 ** 9 + 7
for (a, b, s) in list(ABS.keys()):
	if a == b == 0:
		continue
	p = ABS[a, b, s]
	n = ABS[b, a, -s]
	ABS[a, b, s] = 0
	ABS[b, a, -s] = 0
	cnt = pow(2, p, MOD) + pow(2, n, MOD) - 1
	ans = ans * cnt % MOD
ans += ABS[0, 0, 0]
print((ans - 1) % MOD)