#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const long long mod = 1e9 + 7;
const long long N = 2e5 + 1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long po[N + 1];
  po[0] = 1;
  for (long long i = (1); i <= (N); i++) po[i] = po[i - 1] * 2 % mod;
  long long n;
  cin >> n;
  ;
  map<long double, long long> mp;
  for (long long i = (1); i <= (n); i++) {
    long double a, b;
    cin >> a >> b;
    if (b == 0)
      mp[b]++;
    else
      mp[a / b]++;
  }
  long long cnt = po[mp[0]];
  for (auto i : mp) {
    if (i.first == 0) continue;
    long long x = mp[(-1.00) / (long double)(i.first)];
    if (i.first < 0) {
      if (x)
        continue;
      else
        cnt = cnt * po[i.second] % mod;
    } else if (i.second)
      cnt = cnt * (po[i.second] + po[x] - 1) % mod;
  }
  cnt = (((cnt - 1) % mod) + mod) % mod;
  cout << cnt << '\n';
  ;
}
