#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9 + 7;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long pct(long long x) { return __builtin_popcount(x); }
long long bit(long long x) { return 31 - __builtin_clz(x); }
long long cdiv(long long a, long long b) {
  return a / b + !(a < 0 || a % b == 0);
}
void DBG() { cerr << "]" << endl; }
template <class H, class... T>
void DBG(H h, T... t) {
  cerr << to_string(h);
  if (sizeof...(t)) cerr << ", ";
  DBG(t...);
}
const long long maxn = 1e5 * 3 + 20;
long long pw[maxn];
long long n, _, q, k;
void solve() {
  pw[0] = 1;
  for (signed i = 1; i <= maxn - 10; i++) {
    pw[i] = pw[i - 1] * 2 % mod;
  }
  cin >> n;
  long long ans = 0;
  map<pair<long long, long long>, pair<long long, long long> > check;
  for (signed i = 1; i <= n; i++) {
    long long x, y;
    cin >> x >> y;
    if (!x && !y) {
      ans++;
      ans %= mod;
      continue;
    } else {
      if (x < 0 || (!x && y < 0)) {
        x = -x;
        y = -y;
      }
      long long g = gcd(abs(x), abs(y));
      x /= g;
      y /= g;
      if (y > 0) {
        check[{x, y}].first++;
      } else {
        check[{-y, x}].second++;
      }
    }
  }
  long long tmp = 1;
  for (auto& p : check) {
    tmp *= (pw[p.second.first] + pw[p.second.second] - 1) % mod;
    tmp %= mod;
  }
  cout << (tmp + ans - 1) % mod << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
