#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const ll mod = 1e9 + 7;
const ll mask = 1e9;
using node = tuple<ll, ll, ll>;
ll p2[300000];
void init_p2() {
  p2[0] = 1;
  for (int i = 1; i < 300000; ++i) {
    p2[i] = (p2[i - 1] * 2) % mod;
  }
}
ll gcd(ll a, ll b) {
  if (b > a) {
    swap(a, b);
  }
  if (a % b == 0) {
    return b;
  }
  return gcd(b, a % b);
}
int main(void) {
  init_p2();
  map<node, int> m;
  int n;
  cin >> n;
  auto fish = vector<node>(n);
  for (int i = 0; i < n; ++i) {
    ll a, b;
    cin >> a >> b;
    ll abs_a = (ll)abs(a), abs_b = (ll)abs(b);
    ll g = gcd(abs_a, abs_b);
    ll s = (a / abs_a) * (b / abs_b);
    node f = node{abs_a / g, abs_b / g, s};
    fish[i] = f;
    m[f]++;
  }
  ll res = 1LL;
  for (int i = 0; i < n; ++i) {
    ll a, b, s;
    tie(a, b, s) = fish[i];
    node inv = node{b, a, -s};
    if (m.find(inv) == m.end()) {
      res = (res * 2) % mod;
    }
  }
  for (auto kv : m) {
    ll a, b, s;
    tie(a, b, s) = kv.first;
    node inv = node{b, a, -s};
    if (m.find(inv) == m.end() || s < 0) {
      continue;
    }
    int n_pos = kv.second;
    int n_neg = m[inv];
    ll mult = (p2[n_pos] - 1LL + p2[n_neg] - 1LL + 1LL) % mod;
    res = (res * mult) % mod;
  }
  cout << res - 1LL << endl;
  return 0;
}
