#include <bits/stdc++.h>
using namespace std;


const int combination_max=100000+10;
const int combination_modulo=1000000007;
vector<int64_t> factorials(combination_max);
vector<int64_t> factorials_inv(combination_max);
vector<int64_t> inverse(combination_max);
int combination_mod(int n, int k);
int prepare_combination_mod();
	

int64_t multiply_new_set(int64_t count, int c1, int c2);

int main()
{
	int n;
	cin >> n;

	vector<int64_t> a(n), b(n);
	for (int i=0;i<n;++i)
	{
		cin >> a[i] >> b[i];
	}

	map<pair<int64_t,int64_t>,int> iwashi_count;
	for (int i=0;i<n;++i)
	{
		if (a[i]==0)
		{
			if (b[i]==0)
			{
				iwashi_count[make_pair(0,0)]++;
			}
			else
			{
				iwashi_count[make_pair(0,1)]++;
			}
		}
		else if (b[i]==0)
		{
			iwashi_count[make_pair(1,0)]++;
		}
		else
		{
			int64_t aa,bb;
			if (a[i]<0)
			{
				a[i]=-a[i];
				b[i]=-b[i];
			}
			int64_t g=__gcd(a[i],abs(b[i]));
			aa=a[i]/g;
			bb=b[i]/g;
			iwashi_count[make_pair(aa,bb)]++;
		}
	}

	for (pair<pair<int64_t,int64_t>,int> p : iwashi_count)
	{
		//fprintf(stderr,"(%lld %lld) %d\n",p.first.first, p.first.second, p.second);
	}

	prepare_combination_mod();
	int64_t count=1;
	int last_offset=-1;
	if (iwashi_count.count(make_pair(0,0))>0)
	{
		last_offset+=iwashi_count[make_pair(0,0)];
		iwashi_count[make_pair(0,0)]=0;
	}

	if ( (iwashi_count.count(make_pair(1,0))>0) || (iwashi_count.count(make_pair(0,1))>0) )
	{
		int c1=iwashi_count[make_pair(1,0)];
		int c2=iwashi_count[make_pair(0,1)];
		count=multiply_new_set(count,c1,c2);
		iwashi_count[make_pair(1,0)]=0;
		iwashi_count[make_pair(0,1)]=0;
	}

	for (pair<pair<int64_t,int64_t>,int> p: iwashi_count)
	{
		int c1=p.second;
		pair<int64_t,int64_t> p2;
		if (p.first.second>=0)
		{
			p2=make_pair(p.first.second,-p.first.first);
		}
		else
		{
			p2=make_pair(-p.first.second,p.first.first);
		}

		if (c1<=0)
		{
			continue;
		}

		if (iwashi_count.count(p2)>0)
		{
			//fprintf(stderr,"\t(%lld,%lld) %d, (%lld,%lld) %d\n",p.first.first,p.first.second,p.second, p2.first,p2.second,iwashi_count[p2]);
			count=multiply_new_set(count,c1,iwashi_count[p2]);
			iwashi_count[p.first]=0;
			iwashi_count[p2]=0;
		}
		else
		{
			//fprintf(stderr,"\t(%lld,%lld) %d\n",p.first.first,p.first.second,p.second );
			count=multiply_new_set(count,c1,0);
			iwashi_count[p.first];
		}
	}

	count+=last_offset;
	cout << count << endl;	

}


int64_t multiply_new_set(int64_t count, int c1, int c2)
{
	int64_t new_count=1;

	for (int i=1;i<=c1;++i)
	{
		new_count+=combination_mod(c1,i);
		new_count%=combination_modulo;
	}
	for (int i=1;i<=c2;++i)
	{
		new_count+=combination_mod(c2,i);
		new_count%=combination_modulo;
	}
	//fprintf(stderr, "%lld - (%d %d)=%lld  ",count,c1,c2,new_count);
	count*=new_count;
	count%=combination_modulo;
	//fprintf(stderr,"%lld\n",count);
	return count;
}




int prepare_combination_mod()
{
	factorials[0]=1;
	factorials[1]=1;
	factorials_inv[0]=1;
	factorials_inv[1]=1;
	inverse[1]=1;
	for (int i=2;i<combination_max;++i)
	{
		factorials[i]=factorials[i-1]*i%combination_modulo;
		inverse[i]=combination_modulo - inverse[combination_modulo%i]*(combination_modulo/i)%combination_modulo;
		factorials_inv[i]=factorials_inv[i-1]*inverse[i]%combination_modulo;
	}
	return 0;
}

int combination_mod(int n, int k)
{
	return factorials[n]*(factorials_inv[k]*factorials_inv[n-k]%combination_modulo)%combination_modulo;
}



