//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define bit(n,k) (((ll)n>>(ll)k)&1) /*nのk bit目*/
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
//const ll MOD=998244353LL;
//const ll MAX_V=114514LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
vl dx={-1,-1,-1,0,0,1,1,1};
vl dy={1,-1,0,1,-1,1,0,-1};
ll modpow(ll a, ll n, ll mod) {
  
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main(){
  ll n;cin>>n;
  vl a(n),b(n);
  vl hugou(n);
  rep(i,n)cin>>a[i]>>b[i];
  map<pair<ll,P>,ll>M;
  rep(i,n){
    ll g=__gcd(a[i],b[i]);
    a[i]/=g;b[i]/=g;
    if((a[i]>0&&b[i]>0)||(a[i]<0&&b[i]<0))hugou[i]=1;
    else if(a[i]==0||b[i]==0)hugou[i]=0;
    else hugou[i]=-1;
    a[i]=abs(a[i]);
    b[i]=abs(b[i]);
    pair<ll,P> p;
    p.first=hugou[i];
    p.second.first=a[i];
    p.second.second=b[i];
    M[p]++;
  }
  ll ans=1;
  for(auto bigp:M){
    ll part=1;
    pair<ll,P> p=bigp.first;
    //cout<<p.first<<" "<<p.second.first<<" "<<p.second.second<<" "<<bigp.second<<endl;
    pair<ll,P>con;
    con.first=-1;
    con.second.first=p.second.second;
    con.second.second=p.second.first;
    if(p.first==1&&M[con]>0)continue;
    part*=modpow(2,bigp.second,MOD);
    if(bigp.first.first==-1){
      ll part2=1;
      pair<ll,P>rev;
      rev.first=1;
      rev.second.first=p.second.second;
      rev.second.second=p.second.first;
      part2*=modpow(2,M[rev],MOD);
      part+=part2;
      part+=MOD;
      part--;
      part%=MOD;
    }
    ans*=part;
    ans%=MOD;
  }
  ans+=MOD;
  ans--;
  ans%=MOD;
  cout<<ans<<endl;
  
}