#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define N 200010
#define pb push_back
#define fi first
#define se second
#define si size()
#define ll long long
#define mp make_pair
#define iter ::iterator
#define all(v) v.begin(), v.end()
#define READ(f) freopen (f, "r", stdin)
#define WRITE(f) freopen (f, "w", stdout)
#define pp pop_back
#define mapiter map<int, int>::iterator
#define pii pair<int, int>
#define forn(i, n) for(int i = 0; i < n; ++i)
#define forn1(i, n) for(int i = 1; i <= n; ++i)
#define forr(i, x, n) for(int i = x; i <= n; ++i)
#define barnarnar ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI 3.141592653589793238462643383279502884L
#define elif else if
#define lld long double
#define r0 return 0

const int inf = 1e9 + 1;
const ll modw = 1e9 + 7;
  
using namespace std;
using namespace __gnu_pbds;

map<pair<ll, ll>, int> m;

ll binpow(ll a, ll n)
{
	if(n == 0)	return 1ll;
	if(n % 2 == 1)	return (binpow(a, n - 1) * a) % modw;
	else
	{
		ll b = binpow(a, n / 2) % modw;
		return (b * b) % modw;
	}
}

int main()
{
	int n;
	cin >> n;
	vector<pair<ll, ll> > a;
	ll tc = 0;
	forn(i, n)
	{
		int t1, t2;
		cin >> t1 >> t2;
		if(!(!t1 && !t2))	a.pb(mp(t1, t2));
		else	tc++;
	}
	n = a.si;
	ll sa = 0, sb = 0;
	forn(i, n)
	{
		if(a[i].se == 0)	sa++;
		elif(a[i].fi == 0)	sb++;
		else
		{
			ll g = __gcd(a[i].fi, a[i].se);
			a[i].fi /= g;
			a[i].se /= g;
			m[mp(a[i].fi, a[i].se)]++;
		}
	}
	unsigned ll ans = (binpow(2ll, sa) + binpow(2ll, sb) - 1);
	ans %= modw;
	set<pair<ll, ll> > used;
	for(auto i:m)
	{
		if(used.find(mp(i.fi.fi, i.fi.se)) != used.end())	continue;
		pair<ll, ll> op = mp(i.fi.se, -i.fi.fi);
		if(!m[op])
		{
			ans *= binpow(2ll, i.se);
		}
		else
		{
			ans *= (binpow(2ll, i.se) + binpow(2ll, m[op]) - 1) % modw;
		}
		ans %= modw;
		used.insert(op);
		//cout << i.fi << ' ' << op << ' ' << i.se << ' ' << m[op] << ' ' << ans << endl;
	}
	ans += tc;
	ans %= modw;
	cout << (ans + modw * 100ll - 1) % modw;
}







