#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
random_device rnd;
mt19937 mt(rnd());
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;
ll gcd(ll a, ll b) {
  if (a < b) {
    swap(a, b);
  }
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll mpow(ll base, ll num) {
  if (num == 0) return 1ll;
  ll prev = mpow(base, num / 2);
  if (num % 2 == 0) {
    return (prev * prev) % MOD;
  } else {
    return (((prev * base) % MOD) * prev) % MOD;
  }
}
int main() {
  int n;
  cin >> n;
  VL a(n), b(n);
  map<PII, ll> mp;
  for (int i = (0); i < (n); ++i) {
    cin >> a[i] >> b[i];
    ll g = gcd(llabs(a[i]), llabs(b[i]));
    if (g != 0) {
      a[i] /= g;
      b[i] /= g;
    }
    mp[{a[i], b[i]}]++;
  }
  map<PII, bool> used;
  ll ans = 1;
  for (int i = (0); i < (n); ++i) {
    if (a[i] != 0 && b[i] != 0) {
      if (used[{a[i], b[i]}]) continue;
      ll tmp = 1;
      tmp +=
          (mpow(2, mp[{a[i], b[i]}]) * mpow(2, mp[{-a[i], -b[i]}]) - 1) % MOD;
      tmp %= MOD;
      tmp +=
          (mpow(2, mp[{-b[i], a[i]}]) * mpow(2, mp[{b[i], -a[i]}]) - 1) % MOD;
      tmp %= MOD;
      used[{a[i], b[i]}] = true;
      used[{-b[i], a[i]}] = true;
      used[{b[i], -a[i]}] = true;
      used[{-a[i], -b[i]}] = true;
      tmp %= MOD;
      ans *= tmp;
    } else if (a[i] != 0 && b[i] == 0) {
      if (used[{a[i], b[i]}]) continue;
      ll tmp = 1;
      tmp += mpow(2, mp[{a[i], b[i]}]) - 1;
      tmp %= MOD;
      tmp += mpow(2, mp[{b[i], a[i]}]) - 1;
      tmp %= MOD;
      tmp += mpow(2, mp[{b[i], -a[i]}]) - 1;
      used[{a[i], b[i]}] = true;
      used[{-b[i], a[i]}] = true;
      used[{b[i], -a[i]}] = true;
      used[{-a[i], -b[i]}] = true;
      tmp %= MOD;
      ans *= tmp;
    } else if (a[i] == 0 && b[i] != 0) {
      if (used[{a[i], b[i]}]) continue;
      ll tmp = 1;
      tmp += mpow(2, mp[{a[i], b[i]}]) - 1;
      tmp %= MOD;
      tmp += mpow(2, mp[{b[i], a[i]}]) - 1;
      tmp %= MOD;
      tmp += mpow(2, mp[{-b[i], a[i]}]) - 1;
      used[{a[i], b[i]}] = true;
      used[{-b[i], a[i]}] = true;
      used[{b[i], -a[i]}] = true;
      used[{-a[i], -b[i]}] = true;
      tmp %= MOD;
      ans *= tmp;
    } else {
      ans += 1;
    }
    ans %= MOD;
  }
  cout << (ans + MOD - 1) % MOD << endl;
  return 0;
}
