#include "bits/stdc++.h"
#define ll long long
#define mk make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
using namespace std;
const int MAXN=1e5+9;
const ll MOD=1e9+7;
inline ll fastexpo(ll base, ll expo, ll mod) {
	ll result=1;
	while(expo) {
		if(expo%2) {
			result=result*base;
			result%=mod;
		}
		base=base*base;
		base%=mod;
		expo=(expo/2ll);
	}
	return result;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	map<pll,ll> mp,rev_mp;
	for(int i=0;i<n;i++)
	{
		ll sign=1;
		ll x,y;
		cin>>x>>y;
		if(x<0)
		{
			sign*=-1;
		}
		if(y<0)
		{
			sign*=-1;
		}
		ll g;
		if(x==0&&y==0)
		{
			g=1;
		}
		else
		{
			g=__gcd(abs(x),abs(y));
		}
		x=x/g;
		y=y/g;
		y=abs(y);
		x=abs(x);
		x=sign*x;
		if(y==0)
		{
			x=abs(x);
		}
		mp[mk(x,y)]++;
	}
	ll fans=1;
	ll flag=0;
	ll glob=0;
	while(!mp.empty())
	{
		auto it=mp.begin();
		pll p=(it->first);
		ll num=p.first;
		ll den=p.second;
		swap(num,den);
		num=-num;
		ll sign=1;
		if(num<0)
		{
			sign=sign*-1;
		}
		if(den<0)
		{
			sign=sign*-1;
		}
		num=abs(num);
		den=abs(den);
		num=sign*num;
		if(den==0)
		{
			num=abs(num);
		}
		if(num==0&&den==0)
		{
			flag=1;
		}
		else
		{
			if(mp.find(mk(num,den))!=mp.end())
			{
				ll ff=(it->second);
				ll ss=mp[mk(num,den)];
				fans=fans*((fastexpo(2,ff,MOD)+fastexpo(2,ss,MOD))-1)%MOD;
				fans%=MOD;
				if(fans<0)
				{
					fans+=MOD;
				}
				mp.erase(mp.find(mk(num,den)));
			}
			else
			{
				glob+=(it->second);
			}
		}
		mp.erase(it);
	}
	fans=fans*fastexpo(2,glob,MOD);
	fans%=MOD;
	// fans+=flag;
	fans--;
	fans%=MOD;
	if(fans<0)
	{
		fans+=MOD;
	}
	fans%=MOD;
	cout<<fans<<endl;
	return 0;
}