#include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, b, e) for(int i = (b); i <= (int)(e); ++i)
#define FORD(i, b, e) for(int i = (b); i >= (int)(e); --i)

#define sim template<class n
sim, class s> ostream & operator << (ostream &p, pair<n, s> x)
{return p << "<" << x.f << ", " << x.s << ">";}
sim> auto operator << (ostream &p, n y) ->
typename enable_if<!is_same<n, string>::value, decltype(y.begin(), p)>::type 
{int o = 0; p << "{"; for(auto c: y) {if(o++) p << ", "; p << c;} return p << "}";}
void dor() {cerr << endl;}
sim, class...s> void dor(n p, s...y) {cerr << p << " "; dor(y...);}
sim, class s> void mini(n &p, s y) {if(p>y) p = y;}
sim, class s> void maxi(n &p, s y) {if(p<y) p = y;}
#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif 

#define I(x) #x " =", (x), " "
#define A(a, i) #a "[" #i " =", i, "] =", a[i], " "

map<PII, int> M;
int mod = 1e9+7;

const int MXN = 2e5+5;
int pot2[MXN];

int main()
  {
  ios_base::sync_with_stdio(0); 
  int n;
  cin >> n;
  pot2[0] = 1;
  FOR(i, 1, n)pot2[i] = pot2[i-1] * 2 % mod;

  int zero = 0;
  REP(i, n)
    {
    int x, y;
    cin >> x >> y;

    if(x == 0 && y == 0)
      {
      zero++;
      continue;
      }

    int g = __gcd(abs(x), abs(y));

    x /= g;
    y /= g;
    if(x < 0){x *= -1; y *= -1;}
    if(x == 0){y = 1;}

    M[{x, y}]++;
    }

  LL res = 1;
  for(auto i: M)
    {
    PII druga = MP(i.f.s, -i.f.f);
    if(druga.f < 0)
      {
      druga.f *= -1;
      druga.s *= -1;
      }
    if(druga.f == 0)druga.s = 1;

    if(MP(i.f.f, i.f.s) < druga || M.count(druga) == 0)
      {
      int ways1 = i.s;
      int ways2 = 0;
      if(M.count(druga))ways2 = M[druga];

      debug(i.f, druga, ways1, ways2);

      res = res * (pot2[ways1] + pot2[ways2]-1) % mod;
      }
    }
  cout << (res - 1 + mod + zero) % mod << endl;
  }
