#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

ll mod=1e9+7;

ll modpow(ll a, ll p) {
  ll ret=1;
  while(p>0) {
    if(p&1) ret=(ret*a)%mod;
    a=(a*a)%mod;
    p>>=1;
  }
  return ret;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a,b,d,n,ans=1,zero_w=0;cin>>n;
  map<P,P> mp;
  rep(i,n) {
    cin>>a>>b;
    if(a==0&&b==0) {zero_w++;continue;}
    d=gcd(a,b);
    a/=d,b/=d;
    if(b<0) a=-a,b=-b;
    if (b==0&&a<0) a=-a,b=-b;
    if(a<=0) {
      ll a_=a;
      a=b;b=-a_;
      mp[P(a,b)].first++;
    }
    else mp[P(a,b)].second++;
  }
  for(auto p:mp) {
    a=p.second.first;b=p.second.second;
    ll ans_=1;
    ans_+=modpow(2,a)-1;
    ans_+=modpow(2,b)-1;
    ans_%=mod;
    ans*=ans_;
    ans%=mod;
  }
  ans+=zero_w-1;
  ans%=mod;
  print(ans);
  return 0;
}