#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 modpow(ll a, ll p) {
  ll ret=1,mod=1e9+7;
  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=0,mod=1e9+7;cin>>n;
  map<P,ll> pos,neg;
  ll zero_a,zero_b,zero_w;
  rep(i,n) {
    cin>>a>>b;
    d=__gcd(a,b);
    if(a*b>0) pos[P(a/d,b/d)]++;
    else if(a*b<0) pos[P(abs(a/d),abs(b/d))]++;
    else if(a==0&&b!=0) zero_a++;
    else if(a!=0&&b==0) zero_b++;
    else zero_w++;
  }
  ans=modpow(2,n-zero_w);
  ans-=(modpow(2,zero_a)-1)*(modpow(2,zero_b)-1)*modpow(2,n-zero_w-zero_a-zero_b);
  while(ans<0) ans+=mod;
  ll num=0;
  for(auto e:pos) {
    a=e.first.first,b=e.first.second,num=p.second;
    auto inv=neg(P(b,a));
    if(inv.second==0) continue;
    num*=inv;
    ans=(ans-(modpow(2,num)-1)*modpow(2,n-2*num))%mod;
    while(ans<0) ans+=mod;
  }
  print(ans);
  return 0;
}