#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
constexpr int MAXN = 5 + 2e5;
constexpr int MOD = 7 + 1000000000;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
int mul(int a, int b) { return (int)((1LL * a * b) % MOD); }
int add(int a, int b) {
  int ans = a + b;
  if (ans >= MOD) ans -= MOD;
  return ans;
}
int sub(int a, int b) {
  int ans = a - b;
  if (ans < 0) ans += MOD;
  return ans;
}
int fpow(int b, int e) {
  int ans = 1, p = b;
  for (; e; e >>= 1) {
    if (e & 1) ans = mul(ans, p);
    p = mul(p, p);
  }
  return ans;
}
int f[MAXN];
int choose(int n, int k) {
  return mul(f[n], fpow(mul(f[k], f[n - k]), MOD - 2));
}
struct F {
  ll a, b;
  F(ll x, ll y) {
    ll g = max(1LL, gcd(abs(x), abs(y)));
    tie(a, b) = pll{x / g, y / g};
  }
  pll get() { return pll{abs(a), abs(b)}; }
};
int s(ll x) {
  if (x == 0) return 0;
  return x < 0 ? -1 : 1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  f[0] = 1;
  for (int i = (int)1; i < (int)MAXN; ++i) {
    f[i] = mul(i, f[i - 1]);
  }
  int n;
  cin >> n;
  vector<F> v;
  v.reserve(n);
  for (int i = (int)0; i < (int)n; ++i) {
    ll a, b;
    cin >> a >> b;
    v.push_back(F(a, b));
  }
  map<pll, ii> pos;
  bool ind = false;
  for (auto x : v) {
    int s1 = s(x.a), s2 = s(x.b);
    if (s1 != 0 && s2 != 0) {
      if (s1 == s2) {
        pos[x.get()].first++;
      } else {
        auto w = x.get();
        swap(w.first, w.second);
        pos[w].second++;
      }
    } else {
      if (s1 == 0 && s2 == 0) {
        ind = true;
      } else if (s1 == 0) {
        pos[{0, 0}].first++;
      } else if (s2 == 0) {
        pos[{0, 0}].second++;
      }
    }
  }
  int ans = 1;
  for (auto x : pos) {
    auto cnt = x.second;
    int maxi = max(cnt.first, cnt.second);
    int tot = 1;
    for (int i = 1; i <= maxi; ++i) {
      if (i <= cnt.first) {
        tot = add(tot, choose(cnt.first, i));
      }
      if (i <= cnt.second) {
        tot = add(tot, choose(cnt.second, i));
      }
    }
    ans = mul(ans, tot);
  }
  cout << add(sub(ans, 1), ind ? 1 : 0) << '\n';
  return 0;
}
