#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
    result=(result*base)%modulus;
    exponent=exponent>>1;
    base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
  if(N<K)return 0;
  if(K==0)return 1;
  if(N==0)return 0;

  ll den=1;
  for(ll i=1;i<=K;i++)den*=i;
  ll num=1;
  while(K--){
    num*=N;
    if(num%den==0){
      num/=den;
      den=1;
    }
    N--;
  }

  return num;
}
*/
ll n;
vll a;
int main(){FAST;
cin>>n;
ll shaka = 0;
ll laka = 0;
ll boomboom = 0;

for(ll i=1;i<=n;++i){
  ll x,y;cin>>x>>y;
  if(!x)shaka++;
  if(!y)laka++;
  if(!x and !y)boomboom++;
  if(x and y)
    a.pb({x,y});
}

shaka-=boomboom;
laka-=boomboom;

ll haah = (mpow(2LL,shaka,MOD)-1+MOD)%MOD;
ll hooh = (mpow(2LL,laka,MOD)-1+MOD)%MOD; 
ll ans = (haah+hooh+1)%MOD;
ans%=MOD;

n = a.size();

map<pair<pll,pll>,ll>M;

for(ll i=0;i<n;++i){
  pll foo,bar;
  
  {
    ll num = a[i].first;
    ll den = a[i].second;
    ll g = gcd(abs(num),abs(den));
    num/=g;
    den/=g;
    if(den<0){
      num = -num;
      den = -den;
    }
    foo = {num,den};
  }
  {
    ll num = a[i].second;
    ll den = a[i].first;
    ll g = gcd(abs(num),abs(den));
    num/=g;
    den/=g;
    num = -num;
    if(den<0){
      num = -num;
      den = -den;
    }
    bar = {num,den};
  }

  M[{foo,bar}]++;

}

map<pair<pll,pll>,ll>f;

for(auto it:M){
  pll foo = it.first.first;
  pll bar = it.first.second;
  // cout<<foo.first<<'/'<<foo.second<<' '<<bar.first<<'/'<<bar.second<<'\n';
  if(f.count({foo,bar}) or f.count({bar,foo}))continue;
  ll x = it.second;
  ll y = 0;
  if(M.count({bar,foo})){
    y = M[{bar,foo}];
  }
  // cout<<" CT "<<it.second<<' '<<y<<'\n';
  f[{foo,bar}]++;
  ll boom = (mpow(2LL,x,MOD)-1+MOD)%MOD;
  ll baam = (mpow(2LL,y,MOD)-1+MOD)%MOD;
  ll plis = (boom+baam+1)%MOD;
  ans = ans*plis%MOD;
}

ans = (ans-1+MOD)%MOD;

ans+=boomboom;
ans%=MOD;

cout<<ans;

return 0;
}

/*
 WA? check edge cases, N=1,M=1 etc. Read code fully once and check all variables.
 Read the question again and see what you might have missed.
 Consider changing your solution or find more cases.
 */


Measured memory_bytes: 37504