#include <bits/stdc++.h>
using namespace std;
const int maxn = 200009;
const long long MOD = 1e9 + 7;
class {
 public:
  double A[maxn], B[maxn];
  map<double, int> mp;
  long long pw2[maxn];
  void solve() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> A[i] >> B[i];
    pw2[0] = 1;
    for (int i = 1; i < maxn; ++i) pw2[i] = pw2[i - 1] * 2 % MOD;
    int A0 = 0, B0 = 0;
    int add = 0;
    for (int i = 1; i <= n; ++i) {
      if (A[i] == 0 && B[i] == 0) {
        add++;
        continue;
      }
      if (A[i] == 0)
        A0++;
      else if (B[i] == 0)
        B0++;
      else {
        mp[A[i] / B[i]]++;
      }
    }
    long long ans = 1;
    for (auto i : mp) {
      if (i.second == 0) continue;
      double j = -1 / i.first;
      if (mp.count(j)) {
        (ans *= (pw2[i.second] + pw2[mp[j]] + MOD - 1) % MOD) %= MOD;
        mp[j] = 0;
      } else {
        (ans *= pw2[i.second]) %= MOD;
      }
    }
    if (A0 == 0 && B0) {
      (ans *= pw2[B0]) %= MOD;
    } else if (A0 && !B0) {
      (ans *= pw2[A0]) %= MOD;
    } else if (A0 && B0) {
      (ans *= (pw2[A0] + pw2[B0] + MOD - 1) % MOD) %= MOD;
    }
    ans += add - 1;
    ans = (ans % MOD + MOD) % MOD;
    cout << ans << '\n';
  }
} NSPACE;
int main() {
  ;
  ;
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  NSPACE.solve();
}
