long gcd(a,b)long a,b;{return b?gcd(b,a%b):a;}
const long mod=1e9+7;
long pow(a,b)long a,b;{return b?pow(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
struct X{long A,B;int f}A[2<<17];
O=mod-1;
cmp(a,b)struct X*a,*b;{
	long dA=a->A-b->A,dB=a->B-b->B;
	return dA?dA<0?-1:1:dB?dB<0?-1:1:0;
}
main(N)
{
	scanf("%d",&N);
	int sz=0;
	for(int i=0;i<N;i++)
	{
		long a,b;scanf("%ld%ld",&a,&b);
		if(!a&&!b)O++;
		else
		{
			long g=gcd(a,b);
			a/=g;b/=g;
			if(a<0)
			{
				a=-a;
				b=-b;
			}
			int f=0;
			if(a==0)
			{
				a=1;
				b=0;
				f=1;
			}
			else if(b<0)
			{
				long t=a;
				a=-b;
				b=t;
				f=1;
			}
			A[sz].A=a;
			A[sz].B=b;
			A[sz].f=f;
			sz++;
		}
	}
	qsort(A,sz,sizeof(struct X),cmp);
	long ans=1;
	for(int i=0;i<sz;)
	{
		int c[2]={};
		int j=i;
		while(i<sz&&A[i].A==A[j].A&&A[i].B==A[j].B)
		{
			c[A[i++].f]++;
		}
		ans=ans*(pow(2,c[0])+pow(2,c[1])-1)%mod;
	}
	printf("%d\n",(ans+O)%mod);
}