#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)1000000007;

vll A, B;
ll N;
vll kaijo;
vpll p;
vll dp;

ll gcd(ll x, ll y){
  if(y==0) return x;
  return gcd(y, x-(x/y)*y);
}

ll search(ll index){
  if(index>=p.size()) return dp[index] = 1;
  if(dp[index]>=0) return dp[index];
  ll C1 = p[index].first;
  ll C2 = p[index].second;
  //debug_print(index, C1, C2);
  ll tmp1 = (kaijo[C1]-1+MOD)%MOD;
  ll tmp2 = (kaijo[C2]-1+MOD)%MOD;
  return dp[index] = ((tmp1+tmp2+1)*search(index+1))%MOD;
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  IN(N);
  A.resize(N);
  B.resize(N);
  map<pair<ll, ll>, ll> mp;

  REP(i,N){
    IN(A[i], B[i]);
    ll g = gcd(abs(A[i]), abs(B[i]));
    if(g>0){
      A[i]/=g;
      B[i]/=g;
    }
    if(A[i]<0){
      A[i]*=-1;
      B[i]*=-1;
    }else if(A[i]==0){
      B[i] = abs(B[i]);
    }
    mp[make_pair(A[i], B[i])]++;
    //debug_print(A[i], B[i], g);
  }
  
  ll zero = 0;
  if(mp.find(make_pair(0, 0))!=mp.end()){
    zero = mp[make_pair(0, 0)];
  }

  kaijo.resize(N+1, 1);
  REP(i,N){
    kaijo[i+1] = (2*kaijo[i])%MOD;
  }

  set<pair<ll, ll>> st;

  for(auto itr : mp){
    ll A = itr.first.first;
    ll B = itr.first.second;
    if(A==0 && B==0) continue;
    if(st.find(make_pair(A,B))!=st.end()) continue;
    ll Aj = -B;
    ll Bj = A;
    if(Aj<0){
      Aj*=-1;
      Bj*=-1;
    }else if(Aj==0){
      Bj = abs(Bj);
    }
    st.emplace(make_pair(A,B));
    st.emplace(make_pair(Aj,Bj));
    p.pb(make_pair(mp[make_pair(A,B)], mp[make_pair(Aj,Bj)]));
  }

  dp.resize(p.size()+1, -1);

  OUT((search(0)+zero-1+MOD)%MOD);

  //vec_print(dp);

 
  return 0;
}

Measured memory_bytes: 68668