#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long mod_pow(long long x, long long n, long long mod = MOD) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) {
      res = res * x % mod;
    }
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
class Rational {
 public:
  long long a;
  long long b;
  Rational(long long a, long long b) {
    long long g = gcd(a, b);
    if (g != 0) {
      this->a = a / g;
      this->b = b / g;
    } else {
      this->a = a;
      this->b = b;
    }
  }

 private:
  long long gcd(long long a, long long b) {
    if (b == 0) return a;
    return gcd(b, a % b);
  }
};
int main() {
  int N;
  cin >> N;
  map<long long, map<long long, long long>> counter;
  vector<Rational> R;
  long long A, B;
  long long Z = 0;
  for (int i = 0; i < N; ++i) {
    cin >> A >> B;
    Rational r(A, B);
    R.push_back(r);
    if (A == 0 && B == 0) {
      Z++;
      continue;
    }
    if (r.b < 0) {
      r.a *= -1;
      r.b *= -1;
    } else if (r.b == 0) {
      r.a = 1;
    }
    counter[r.a][r.b]++;
  }
  map<long long, map<long long, bool>> checked;
  long long ans = 1;
  for (int i = 0; i < N; ++i) {
    Rational r = R[i];
    if (r.a == 0 && r.b == 0) continue;
    if (checked[r.a][r.b]) continue;
    checked[r.a][r.b] = true;
    long long s = counter[r.a][r.b];
    long long t = 0;
    if (r.b == 0) {
      t = counter[0][1];
      checked[0][1] = true;
    } else if (r.a < 0) {
      t = counter[r.b][-r.a];
      checked[r.b][-r.a] = true;
    } else {
      t = counter[-r.b][r.a];
      checked[-r.b][r.a] = true;
    }
    long long v = 0;
    v += mod_pow(2, s);
    v += mod_pow(2, t);
    ans *= (v - 1);
    ans %= MOD;
    fprintf(stderr, "%d: s: %lld, t: %lld, ans: %lld\n", i, s, t, ans);
  }
  fprintf(stderr, "Z = %lld\n", Z);
  ans += (Z - 1);
  if (ans < 0) ans += MOD;
  cout << ans << endl;
  return 0;
}
