#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
template <typename T>
T mod_pow(T x, T n, const T& p) {
  T ret = 1;
  while (n > 0) {
    if (n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
class bunsu {
 public:
  ll a, b;
  bool pn;
  bunsu() {
    a = 0;
    b = 0;
    pn = false;
  }
  bunsu(ll a, ll b, ll pn) {
    this->a = a;
    this->b = b;
    this->pn = pn;
  }
  bool operator<(const bunsu& value) const {
    if (pn != value.pn) return pn < value.pn;
    if (value.a != a) return a < value.a;
    return b < value.b;
  }
};
int main() {
  ll zero = 0;
  ll n;
  cin >> n;
  map<bunsu, ll> mp;
  map<bunsu, bool> exsit;
  vector<pair<ll, ll>> AB;
  vector<bunsu> vb;
  for (ll i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    AB.emplace_back(a, b);
    if (a == 0 && b == 0) {
      vb.emplace_back(0, 0, 0);
      zero++;
      continue;
    } else if (a == 0) {
      vb.emplace_back(0, 1, 0);
      continue;
    } else if (b == 0) {
      vb.emplace_back(1, 0, 0);
      continue;
    }
    ll G = gcd(abs(a), abs(b));
    vb.emplace_back(abs(a / G), abs(b / G),
                    (a < 0 && b > 0) || (a > 0 && b < 0));
  }
  for (ll i = 0; i < n; i++) {
    exsit[vb[i]] = true;
    mp[vb[i]]++;
    mp[bunsu(vb[i].b, vb[i].a, !vb[i].pn)] += 0;
  }
  ll add = 0;
  vector<ll> ANS;
  for (auto i : mp) {
    if (i.first.a == 0 && i.first.b == 0) {
      continue;
    }
    bunsu alt(i.first.b, i.first.a, !i.first.pn);
    ll now = mod_pow(0LL + 2, i.second, MOD) - 1;
    (now += MOD) %= MOD;
    now += mod_pow(0LL + 2, mp[alt], MOD) - 1;
    (now += MOD) %= MOD;
    (now += 1) %= MOD;
    if (exsit[i.first]) {
      ANS.push_back(now);
      exsit[alt] = false;
    }
  }
  ll ans = 1;
  for (auto i : ANS) {
    (ans *= i) %= MOD;
  }
  cout << (ans - 1 + add + MOD + zero) % MOD << endl;
}
