#include <bits/stdc++.h>
using namespace std;
const int64_t MOD = 1000000007;
int64_t _2n[200010];

void init2n()
{
  _2n[0] = 1;
  for (int i = 1; i <= 200000; i++)
    _2n[i] = (_2n[i - 1] * 2) % MOD;
}

int main()
{
  int64_t N, a, b, az = 0, bz = 0, z = 0, ans = 1;
  cin >> N;
  map<pair<int64_t, int64_t>, int64_t> mp;
  for (int i = 0; i < N; i++)
  {
    cin >> a >> b;
    if (a == 0 && b == 0)
    {
      z++;
      continue;
    }
    if (a == 0)
    {
      az++;
      continue;
    }
    if (b == 0)
    {
      bz++;
      continue;
    }
    int64_t g = gcd(a, b);
    a /= g;
    b /= g;
    if (a < 0) // NOTE: aは常に0以上
    {
      a = -a;
      b = -b;
    }
    mp[make_pair(a % MOD, b % MOD)]++;
  }
  init2n();
  for (auto it = mp.begin(); it != mp.end(); it++)
  {
    auto x = *it;
    auto k = x.first;
    int64_t v = x.second;
    if (v == 0)
      continue;
    int64_t na = k.second, nb = k.first;
    if (na < 0)
      na *= -1;
    else
      nb *= -1;
    if (mp.count(make_pair(na, nb)))
    {
      int64_t w = mp.at(make_pair(na, nb));
      ans = (ans * ((_2n[v] + _2n[w] - 1) % MOD)) % MOD;
      mp[make_pair(na, nb)] = 0;
    }
    else
    {
      ans = (ans * _2n[v]) % MOD;
    }
  }
  ans = ans * ((_2n[az] + _2n[bz] - 1) % MOD) % MOD;
  ans--;
  ans += z;
  cout << ans % MOD << endl;
}