#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define mk make_pair
#define mod 1000000007
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define ff first
#define ss second
#define prec(y,x) fixed<<setprecision(y)<<x
#define inf 1e18
#define pi 3.1415926535
typedef tree<ll, null_type, less<ll>, rb_tree_tag,                    //if  using ll change ll to ll
        tree_order_statistics_node_update> pbset;
#define fob(x) find_by_order(x)
ll po(ll x)
{
	ll ans = 1;
	for (int i = 1; i <= x; i++)
	{
		ans *= 2;
		ans %= mod;
	}
	ans--;
	return ans;
}
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ll n;
	cin >> n;
	ll a[n + 1]; ll b[n + 1];
	map<pair<ll, ll>, ll> mp;
	for (ll i = 1; i <= n; i++)
	{
		cin >> a[i] >> b[i];
	}
	for (ll i = 1; i <= n; i++)
	{
		if (a[i] == 0 || b[i] == 0)
		{
			auto it = mp.find(mk(0, 0));
			if (it == mp.end())
				mp[mk(0, 0)] = 1;
			else
				mp[mk(0, 0)]++;
			continue;
		}
		ll c = __gcd(abs(a[i]), abs(b[i]));
		a[i] /= c;
		b[i] /= c;
		if (a[i]*b[i] > 0)
		{
			a[i] = abs(a[i]);
			b[i] = abs(b[i]);
			auto it = mp.find(mk(a[i], b[i]));
			if (it == mp.end())
				mp[mk(a[i], b[i])] = 1;
			else
				mp[mk(a[i], b[i])]++;
		}
		else
		{
			a[i] = abs(a[i]); a[i] *= -1;
			b[i] = abs(b[i]);
			auto it = mp.find(mk(a[i], b[i]));
			if (it == mp.end())
				mp[mk(a[i], b[i])] = 1;
			else
				mp[mk(a[i], b[i])]++;
		}

	}
	ll ans = 1;
	ll aa = mp.size();
	ll arr[aa] = {0};
	auto it = mp.begin();
	for (; it != mp.end(); it++)
	{
		//cout << ans << "d ";
		ll cc = it->ss; //cout << cc << endl;
		if (cc == 0)
			continue;
		else
		{
			it->ss = 0;
			ll aa = it->ff.ff;
			ll bb = it->ff.ss;
			//cout << aa << " " << bb << " " << cc << endl;
			if (aa == 0)
			{
				ll ans1 = 1 + po(cc);
				ans1 %= mod;
				ans *= ans1;
				ans %= mod;
			}
			else
			{
				aa = abs(aa);
				bb = abs(bb);
				swap(aa, bb);
				if (it->ff.ff > 0)
					aa *= -1;

				auto itr = mp.find(mk(aa, bb));
				if (itr == mp.end())
				{
					ll ans1 = 1 + po(cc);
					//cout << ans1 << endl;
					ans1 %= mod;
					ans *= ans1;
					ans %= mod;
				}
				else
				{

					ll g = itr->ss; itr->ss = 0;
					ll ans1 = 1 + po(cc) + po(g);
					ans1 %= mod;
					ans *= ans1;
					ans %= mod;
				}
			}
		}

	}
	ans--;
	ans += mod;
	ans %= mod;
	cout << ans << endl;
	return 0;


}