#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LINF = long long(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1},
          Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long n;
vector<long long> a, b;
long long mpow(long long x, long long n) {
  long long ans = 1;
  while (n != 0) {
    if (n & 1) ans = ans * x % MOD;
    x = x * x % MOD;
    n = n >> 1;
  }
  return ans;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  a.resize(n);
  b.resize(n);
  long long zz = 0;
  long long zn = 0;
  long long nz = 0;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  map<pair<long long, long long>, long long> m;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0 && b[i] == 0)
      zz++;
    else if (a[i] == 0)
      zn++;
    else if (b[i] == 0)
      nz++;
    else {
      long long g = gcd(abs(a[i]), abs(b[i]));
      a[i] /= g;
      b[i] /= g;
      if (b[i] < 0) {
        a[i] *= -1;
        b[i] *= -1;
      }
      m[make_pair(a[i], b[i])]++;
    }
  }
  set<pair<long long, long long>> used;
  long long ans = 1;
  for (auto x : m) {
    if (used.count(x.first)) continue;
    pair<long long, long long> fir = x.first;
    pair<long long, long long> sec = make_pair(x.first.second, x.first.first);
    if (x.first.first < 0) {
      sec.second *= -1;
    } else {
      sec.first *= -1;
    }
    if (m[sec]) {
      ans *= (mpow(2, x.second) + mpow(2, m[sec]) - 1);
      ans %= MOD;
    } else {
      ans *= mpow(2, x.second);
      ans %= MOD;
    }
    used.insert(sec);
  }
  ans *= (mpow(2, zn) + mpow(2, nz) - 1) % MOD;
  ans %= MOD;
  ans += zz;
  ans %= MOD;
  ans--;
  cout << ans % MOD << "\n";
}
