#include <bits/stdc++.h>
using namespace std;
int64_t mod = 1000000007;
int64_t pw(int64_t x, int64_t y) {
  int64_t z;
  if (y == 0)
    return 1;
  else {
    z = pw(x, y / 2) * pw(x, y / 2) % mod;
    if (y % 2 == 1) z = z * x % mod;
    return z;
  }
}
int64_t gcd(int64_t x, int64_t y) {
  int64_t r;
  if (x > y) swap(x, y);
  r = y % x;
  while (r > 0) {
    y = x;
    x = r;
    r = y % x;
  }
  return x;
}
int main() {
  int64_t n, a, b, i, n0 = 0, c, d, ans;
  map<pair<int64_t, int64_t>, pair<int64_t, int64_t>> m;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0)
      n0++;
    else if (b == 0) {
      if (m.count(make_pair(1, 0)))
        m.at(make_pair(1, 0)).first++;
      else
        m[make_pair(1, 0)] = make_pair(1, 0);
    } else if (a == 0) {
      if (m.count(make_pair(1, 0)))
        m.at(make_pair(1, 0)).second++;
      else
        m[make_pair(1, 0)] = make_pair(0, 1);
    } else {
      if (a < 0) {
        a *= -1;
        b *= -1;
      }
      c = max(b, -b);
      d = gcd(a, c);
      a /= d;
      c /= d;
      if (b > 0) {
        if (m.count(make_pair(a, c)))
          m.at(make_pair(a, c)).first++;
        else
          m[make_pair(a, c)] = make_pair(1, 0);
      } else if (b < 0) {
        if (m.count(make_pair(c, a)))
          m.at(make_pair(c, a)).second++;
        else
          m[make_pair(c, a)] = make_pair(0, 1);
      }
    }
  }
  if (m.size() > 0) {
    ans = 1;
    for (auto pp : m) {
      auto p1 = pp.second.first;
      auto p2 = pp.second.second;
      ans = ans * ((pw(2, p1) + pw(2, p2) - 1) % mod) % mod;
    }
    ans = (ans - 1 + n0) % mod;
  } else
    ans = n0;
  cout << ans << endl;
}
