#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll mod(ll x) { return x < 0 ? x + MOD : (x > MOD ? x - MOD : x); }
struct ikan {
  ll A, B;
  bool operator<(const ikan &con) const {
    if (B == con.B) return A < con.A;
    return B < con.B;
  }
};
int pangkat(int num, int derajat) {
  if (derajat == 0) return 1;
  if (derajat == 1) return num;
  int x = pangkat(num, derajat >> 1);
  x = x * (ll)x % MOD;
  if (derajat & 1) x = x * (ll)num % MOD;
  return x;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int N, z_z = 0, z_no = 0, no_z = 0;
  cin >> N;
  map<ikan, int> mp;
  map<ikan, bool> used;
  for (int i = 0; i < N; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      z_z++;
    else if (a == 0)
      z_no++;
    else if (b == 0)
      no_z++;
    else {
      ll fpb = abs(gcd(a, b));
      a /= fpb, b /= fpb;
      if (a < 0 && b > 0)
        a = -a, b = -b;
      else if (a < 0 && b < 0)
        a = -a, b = -b;
      mp[{a, b}]++;
    }
  }
  ll ans = 1;
  ans = ans * ((pangkat(2, no_z) + pangkat(2, z_no) - 1) % MOD) % MOD;
  for (auto &it : mp) {
    if (!used[it.first]) {
      ikan inv = {abs(it.first.B), (it.first.B < 0 ? it.first.A : -it.first.A)};
      ans = ans * ((pangkat(2, mp[it.first]) + pangkat(2, mp[inv]) - 1) % MOD) %
            MOD;
      used[inv] = 1;
    }
  }
  cout << ans - 1 + z_z << endl;
}
