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

typedef long long int ll;
typedef pair<int, int> pii;
bool R(){return true;}
template<typename T, typename ... Args>
bool R(T & x, Args & ... args){return cin >> x && R(args...);}
void init_io(){ios::sync_with_stdio(false);cin.tie(0);}

#define PB push_back
#define MP make_pair
#define FOR(prom, a, b) for(int prom = (a); prom < (b); prom++)
#define FORDE(prom, a, b) for(int prom = (a); prom >= (b); prom--)
#define SV(vec) do{int __sv;R(__sv);vec.PB(__sv);}while(0)
#define ALL(vec) (vec).begin(), (vec).end()
#define MM(co, cim) memset((co), (cim), sizeof((co)))
#define DEB(x) cerr << ">>> " << #x << " : " << x << endl;
#define INF   1000000007
#define INFLL 4000000000000000007LL

//-------------------------------------------------------------------------//
/****************************************
 * MODULARNI ARITMETIKA *
 ****************************************
 Postup: 1) Zadefinovat modulo
         ...
         2) Pouzivat
 */
//-------------------------------------------------------------------------//

namespace modular_arithmetic
{
  #define MOD 1000000007
  
  ll add (ll A, ll B)
  {
    return (A + B) % MOD;
  }
  
  ll sub (ll A, ll B)
  {
    return (A - B + MOD) % MOD;
  }
  
  ll mult (ll A, ll B)
  {
    return (A * B) % MOD;
  }
  
  ll powermod (ll B, ll P)
  {
    ll R = 1;
    B %= MOD;
    while (P > 0)
    {
      if ((P & 1) == 1) R = mult(R, B);
      P >>= 1;
      B = mult(B, B);
    }
    return R;
  }
  
  ll modinv (ll A)
  {
    return powermod(A, MOD - 2);
  }
  
}

using namespace modular_arithmetic;
//-------------------------------------------------------------------------//

int n;
ll dp[200014][3];
map<pair<ll, ll>, int> vectors;
map<pair<pair<ll,ll>, pair<ll,ll>>, map<pair<ll,ll>, int>> grpm;
vector<vector<int>> grps;

ll go (int cg, int ch)
{
  if (cg >= grps.size()) return (ch == 1);
  if (dp[cg][ch] != -1) return dp[cg][ch];
  ll res = go(cg + 1, ch);
  FOR(i, 0, grps[cg].size()) res = add(res, mult(sub(powermod(2, grps[cg][i]), 1), go(cg + 1, min(1, ch + 1))));
  return dp[cg][ch] = res;
}

void solve ()
{
  R(n);
  FOR(i, 0, n)
  {
    ll a, b;
    R(a, b);
    if (a < 0)
    {
      a *= -1;
      b *= -1;
    }
    ll gc = __gcd(abs(a), abs(b));
    a /= gc;
    b /= gc;
    ++vectors[MP(a, b)];
  }
  for (auto en : vectors)
  {
    ll a = en.first.first;
    ll b = en.first.second;
    ll ka = b;
    ll kb = a;
    if (ka < 0) ka *= -1;
    else kb *= -1;
    grpm[minmax(MP(a, b), MP(ka, kb))][MP(a, b)] = en.second;
  }
  for (auto en : grpm) 
  {
    grps.PB(vector<int>());
    for (auto en2 : en.second)
    {
      grps[grps.size() - 1].PB(en2.second);
    }
  }
  FOR(i, 0, 200014) FOR(j, 0, 3) dp[i][j] = -1;
  printf("%lld\n", go(0, 0));
}

int main ()
{
  init_io();
  int t = 1;
  //R(t);
  while (t--) solve();
  return 0;
}
