#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
bool dbgflag = false;
ll gcd(ll a, ll b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  if (a < b) swap(a, b);
  if (b == 0) return a;
  a %= b;
  return gcd(b, a);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  map<pll, ll> iwashi;
  set<pll> iwashicount;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    ll m = gcd(a, b);
    if (m != 0) {
      a /= m;
      b /= m;
    }
    iwashi[pll(a, b)]++;
    iwashicount.insert(pll(a, b));
  }
  if (dbgflag) cout << iwashicount.size() << endl;
  ll cnt = 1;
  ll oth = 0;
  bool flag = true;
  for (pll p : iwashicount) {
    if (p.first * p.second != 0) {
      ll cm = iwashi[pll(p.second, -p.first)];
      ll cp = iwashi[p];
      iwashi[pll(p.second, -p.first)] = 0;
      iwashi[p] = 0;
      if (dbgflag) cout << (1LL << cm) + (1LL << cp) - 1 << endl;
      cnt *= ((1LL << cm) + (1LL << cp) - 1);
      cnt %= 1000000007LL;
    } else {
      if (flag) {
        flag = false;
        ll c1 = iwashi[pll(1, 0)];
        ll c2 = iwashi[pll(0, 1)];
        ll c3 = iwashi[pll(0, 0)];
        oth = (1LL << c1) + (1LL << c2) + (c3 + 1) - 2;
        cnt *= oth;
        cnt %= 1000000007LL;
      }
    }
  }
  cnt = (cnt + 1000000007LL - 1) % 1000000007LL;
  cout << cnt << endl;
}
