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

const int N=2e5+20,MOD=1e9+7;

int n,zero,p[N];
long long a,b,ans=1;
map <pair <long long,long long>,int> m1,m2;

int get(long long a,long long b)
{
	a*=-1;
	if(m2.find({b,a})==m2.end()) return 0;

	long long ans=m2[{b,a}];
	m2.erase({b,a});
	return ans;
}

int main()
{
	p[0]=1;
	for(int i=1;i<N;i++) p[i]=(p[i-1]*2)%MOD;

	scanf("%d",&n);
	while(n--)
	{
		scanf("%lld%lld",&a,&b);

		if(a==0 and b==0)
		{
			zero++;
			continue;
		}

		long long g=__gcd(a,b);
		a/=g,b/=g;
		if(b<0) a*=-1,b*=-1;
		if(a<0) m1[{a,b}]++;
		else m2[{a,b}]++;
	}

	for(auto i:m1)
	{
		a=i.first.first,b=i.first.second;
		ans*=(p[m1[{a,b}]]+p[get(a,b)]-1)%MOD;
		ans%=MOD;
	}

	for(auto i:m2)
	{
		a=i.first.first,b=i.first.second;
		ans*=p[m2[{a,b}]];
		ans%=MOD;
	}

	ans=(ans+zero-1)%MOD;
	while(ans<0) ans+=MOD;
	printf("%lld",ans);
}