#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll MOD = 1000000007;

ll powMod(ll x, ll k) {
  if (k == 0) return 1;
  if (k % 2 == 0)
    return powMod(x * x % MOD, k / 2);
  else
    return x * powMod(x, k - 1) % MOD;
}

int main() {
  int N;
  cin >> N;
  vector<ll> A(N), B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
  }

  map<pair<ll, ll>, pair<int, int>> m;
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] && B[i] == 0) {
      cnt++;
    } else if (A[i] == 0) {
      m[{0, 1}].first++;
    } else if (B[i] == 0) {
      m[{0, 1}].second++;
    } else {
      ll g = __gcd(A[i], B[i]);
      A[i] /= g, B[i] /= g;
      if (B[i] < 0) {
        A[i] *= -1;
        B[i] *= -1;
      }
      if (A[i] > 0) {
        m[{A[i], B[i]}].first++;
      } else {
        m[{B[i], -A[i]}].second++;
      }
    }
  }

  ll ans = 1;
  for (auto a : m) {
    ll tmp = 1;
    tmp += powMod(2, a.second.first) % MOD - 1;
    tmp += powMod(2, a.second.second) % MOD - 1;
    ans *= tmp;
  }

  cout << ans - 1 + cnt << endl;
}