#include <bits/stdc++.h>
using namespace std;
mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
template <typename T>
inline void chkmax(T &x, T y) {
  if (x < y) x = y;
}
template <typename T>
inline void chkmin(T &x, T y) {
  if (x > y) x = y;
}
const long long P = 1e9 + 7;
long long n;
map<pair<long long, long long>, pair<long long, long long> > cnt;
long long abso(long long x) { return x < 0 ? -x : x; }
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qp(long long a, long long k) {
  long long res = 1;
  for (; k; k >>= 1, a = 1ll * a * a % P) {
    if (k & 1) res = 1ll * res * a % P;
  }
  return res;
}
void solve() {
  cin >> n;
  long long res = 1, tot = 0;
  for (long long i = (1), iend = (n); i <= iend; ++i) {
    long long x, y;
    scanf("%lld %lld", &x, &y);
    if (!x && !y) {
      tot++;
      continue;
    }
    if (!x) {
      cnt[pair<long long, long long>(0, abso(y))].first++;
      continue;
    }
    if (!y) {
      cnt[pair<long long, long long>(0, abso(x))].second++;
      continue;
    }
    long long sign = (x < 0) ^ (y < 0);
    long long g = gcd(x = abso(x), y = abso(y));
    x /= g, y /= g;
    if (sign) {
      cnt[pair<long long, long long>(y, x)].second++;
    } else {
      cnt[pair<long long, long long>(x, y)].first++;
    }
  }
  for (auto p : cnt) {
    long long x = p.second.first, y = p.second.second;
    res = 1ll * res * (qp(2, x) + qp(2, y) - 1) % P;
  }
  cout << (1ll * res + tot + P - 1) % P << endl;
}
signed main() {
  solve();
  return 0;
}
