#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long n;
vector<long long> t;
map<long double, int> v;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    long double a, b;
    cin >> a >> b;
    v[a / b]++;
  }
  t.assign(2e5 + 5, 1);
  for (int i = 1; i < t.size(); ++i) {
    t[i] = 2 * t[i - 1];
    t[i] %= MOD;
  }
  long long res = 1;
  set<long double> done;
  for (auto i : v) {
    if (done.find(i.first) != done.end()) continue;
    long long cur = (t[i.second] + t[v[-(1 / i.first)]]) % MOD;
    cur--;
    res *= cur;
    res %= MOD;
    done.insert(i.first);
    done.insert(-(1 / i.first));
  }
  cout << res - 1;
  return 0;
}
