#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
map<pair<ll,ll>,pair<ll,ll>> M;
int Z;
ll p2[202020];
const ll mo=1000000007;

ll modpow(ll a, ll n = mo-2) {
	ll r=1;a%=mo;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	p2[0]=1;
	FOR(i,201010) p2[i+1]=p2[i]*2%mo;
	
	
	cin>>N;
	FOR(i,N) {
		ll X,Y;
		cin>>X>>Y;
		if(X==0 && Y==0) Z++;
		else if(X==0) {
			M[{0,0}].first++;
		}
		else if(Y==0) {
			M[{0,0}].second++;
		}
		else {
			if(Y<0) X=-X,Y=-Y;
			ll g=__gcd(X,Y);
			X/=g;
			Y/=g;
			if(X<0) M[{Y,-X}].first++;
			else M[{X,Y}].second++;
			
		}
	}
	ll ret=1;
	FORR(m,M) {
		ll a=p2[m.second.first]+p2[m.second.second]-1;
		ret=(ret*a)%mo;
	}
	
	cout<<(ret+Z+mo-1)%mo<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
