#include<bits/stdc++.h>
#define ll long long
using namespace std;
map<pair<int,int>,pair<int,int> >m;
int n;
const ll md=1000000007;
ll ans=1;
inline ll qp(ll x,ll y){
	ll rt=1;
	for(;y;y>>=1,(x*=x)%=md)if(y&1)(rt*=x)%=md;
	return rt;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin>>n;int z=0;
	for(int i=1,a,b,f;i<=n;++i){
		cin>>a>>b;
		if(!a and !b)++z;
		else{
			int g=__gcd(a,b);
			a/=g,b/=g,f=0;
			if(a<0 or (a==0 and b>0))a=-a,b=-b;
			if(b<0)g=a,a=-b,b=g,f=1;
			if(f==0)++m[{a,b}].first;
			else ++m[{a,b}].second;
		}
	} 
	for(map<pair<int,int>,pair<int,int> >::iterator it=m.begin();it!=m.end();it++)(ans*=(qp(2,(it->second.first))+qp(2,(it->second.second))-1)%md)%=md;
	cout<<(ans+z-1)%md<<'\n';
}