#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll ans = 1;
const ll mo = 1000000007;
auto mod = [](ll modx) {modx%=mo;modx+=mo;modx%=mo;return modx; };
ll mypow(ll a, ll b)
{
  ll res = 1;
  a %= mo;
  while (b)
  {
    if (b & 1)
      res = res * a % mo;
    a = a * a % mo;
    b >>= 1;
  }
  return res;
}
int main()
{
ll n ;
cin >> n ;
ll cnt=0;
vector<pair<ll,ll>> v(n);
map<pair<ll,ll>,ll> m;
rep(i,n){
  ll a , b ;
  cin >> a >> b ;
  v[i].first=a;
  v[i].second=b;
}
rep(i,n){
  ll a=v[i].first/(__gcd(abs(v[i].first),abs(v[i].second))),b=v[i].second/(__gcd(abs(v[i].first),abs(v[i].second)));
  if(a==0&&b==0){cnt++;continue;}
  else if(a<0){a=-a;b=-b;}
  else if(a==0)b=abs(b);
  m[make_pair(a,b)]++;
  if(b>0)m[make_pair(b,-a)];
  else m[make_pair(-b,a)];
}

for (auto i = m.begin(); i != m.end(); ++i) {
  if(i->first.second>0){
    ans=mod(ans*(mypow(2,i->second)+mypow(2,m[make_pair(i->first.second,-(i->first.first))])-1));
    m[make_pair(i->first.first,i->first.second)]=0;
    m[make_pair(i->first.second,-(i->first.first))]=0;
  }
  else {
    ans=mod(ans*(mypow(2,i->second)+mypow(2,m[make_pair(-(i->first.second),i->first.first)])-1));
    m[make_pair(i->first.first,i->first.second)]=0;
    m[make_pair(-(i->first.second),i->first.first)]=0;
  }
}
cout << ans-1+cnt << endl;
return 0;
}