#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;
  vector<ll> pm(n + 1, 1LL);
  for (int i = 0; i < n; i++) {
    pm[i + 1] = 2 * pm[i] % 1000000007LL;
  }
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a < 0) {
      a = -a;
      b = -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) || (p.first + p.second != 0)) {
      ll cm = (p.second >= 0) ? iwashi[pll(p.second, -p.first)]
                              : iwashi[pll(-p.second, p.first)];
      ll cp = iwashi[p];
      (p.second > 0) ? (iwashi[pll(p.second, -p.first)] = 0)
                     : (iwashi[pll(-p.second, p.first)] = 0);
      iwashi[p] = 0;
      cnt *= pm[cm] + pm[cp] - 1;
      cnt %= 1000000007LL;
    } else {
      ll c3 = iwashi[pll(0, 0)];
      oth = c3;
    }
  }
  cnt = (cnt + oth + 1000000007LL - 1) % 1000000007LL;
  cout << cnt << endl;
}
