#include <bits/stdc++.h>
using namespace std;
int64_t modPow(int64_t a, int64_t b, int64_t d) {
  bitset<40> bit(b);
  string s = bit.to_string();
  int64_t ret = 1;
  for (int i = 0; i < s.length(); ++i) {
    ret *= ret;
    ret %= d;
    if (s[i] - '0') ret *= a;
    ret %= d;
  }
  return ret;
}
int64_t MOD = 1000000007;
int main() {
  int64_t N, ans = 1, u = 0;
  cin >> N;
  map<long double, pair<int64_t, int64_t> > T;
  for (int i = 0; i < N; i++) {
    long double a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      if (u == 0) {
        u++;
      }
      continue;
    }
    if (a == 0 || b == 0) {
      if (a == 0) {
        if (T.count(919191111)) {
          T[919191111].second++;
        } else {
          T[0].first++;
        }
      } else {
        if (T.count(0)) {
          T[0].second++;
        } else {
          T[919191111].first++;
        }
      }
      continue;
    }
    if (T.count(-b / a)) {
      T[-b / a].second++;
    } else {
      T[a / b].first++;
    }
  }
  for (auto p : T) {
    int64_t r = p.second.first, s = p.second.second;
    ans = (modPow(2, r, MOD) + modPow(2, s, MOD) - 1) % MOD * ans % MOD;
  }
  ans += u;
  ans %= MOD;
  if (ans == 0) {
    cout << 0 << endl;
    return 0;
  }
  cout << ans - 1 << endl;
}
