/******************************************
* AHAM BRAHMASHMI ;) *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define F first
#define S second
#define mod 1000000007

ll binpow(ll a, ll b, ll m)
{
	a %= m;
	ll res = 1;
	while (b > 0)
	{
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}

pair<ll, ll> comp(pair<ll, ll> p)
{
	if (p.S >= 0 and p.F >= 0)
		return mp(-p.S, p.F);
	else
		return mp(p.S, -p.F);
}

int main()
{

#ifndef ONLINE_JUDGE
	// for getting input from input.txt
	freopen("input1.txt", "r", stdin);
	// for writing output to output.txt
	freopen("output1.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ll n;
	cin >> n ;
	vector<pair<int, int>> adj(n);
	ll u, v;
	for (int i = 0; i < n; i++)
	{
		cin >> u >> v;
		adj[i] = mp(u, v);
	}
	map<pair<ll, ll>, ll> maps;
	maps[ {0, 0}] = 0;
	for (int i = 0; i < n; i++)
	{
		pair<ll, ll> temp;
		if (adj[i].F == 0 and adj[i].S == 0)
		{
			maps[ {0, 0}]++;
			continue;
		}
		else if (adj[i].F == 0)
		{
			temp = mp(0, 1);
		}
		else if (adj[i].S == 0)
		{
			temp = mp(-1, 0);
		}
		//cout << adj[i].F << " " << adj[i].S << "\n";
		else
		{
			ll gc = __gcd(abs(adj[i].F), abs(adj[i].S));
			ll temp1 = adj[i].F / gc;
			ll temp2 = adj[i].S / gc;
			if (temp1 < 0 and temp2 < 0)
				temp = mp(-temp1, -temp2);
			else if (temp1 > 0 and temp2 < 0)
				temp = mp(-temp1, -temp2);
			else
				temp = mp(temp1, temp2);
		}
		if (maps.find(temp) == maps.end())
			maps[temp] = 1;
		else
			maps[temp]++;
	}


	map<pair<ll, ll>, ll> vis;
	ll out = 1;
	ll ways_for_each_oppo_group = 0;
	for (auto i : maps)
	{
		pair<ll, ll> key = i.F;
		ll val = i.S;
		if (key.F == 0 and key.S == 0)
			continue;
		else if (vis.find(key) == vis.end())
		{
			ll comp_count  = 1;
			cout << key.F << " " << key.S << " " << val << "\n";
			pair<ll, ll> comp_key =  comp(key);
			ways_for_each_oppo_group = 1;
			if (maps.find(comp_key) != maps.end())
			{
				comp_count = binpow(2, maps[comp_key], mod);
			}

			// if (key.F == comp_key.F and key.S == comp_key.S)
			// 	ways_for_each_oppo_group = 1;
			// else
			ways_for_each_oppo_group = binpow(2, maps[key], mod) + comp_count - 1;
			ways_for_each_oppo_group %= mod;
			vis[key] = 1;
			vis[comp(key)] = 1;
			out = (out * ways_for_each_oppo_group) % mod;
			//cout << ways_for_each_oppo_group << " " << out << "\n";
		}
	}
	out = (out - 1 + maps[mp(0, 0)]) % mod;
	cout << out << "\n";
	return 0;
}