#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long n;
vector<long long> t;
map<long long, long long> v;
long long exp(long long a, long long n) {
  if (n == 0) return 1;
  long long tmp = exp(a, n / 2);
  tmp *= tmp;
  tmp %= MOD;
  if (n % 2) tmp *= a;
  tmp %= MOD;
  return tmp;
}
long long inv(long long x) { return exp(x, MOD - 2); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    a = ((a % MOD) + MOD) % MOD;
    b = ((b % MOD) + MOD) % MOD;
    v[(a * inv(b)) % MOD]++;
  }
  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 long> done;
  for (auto i : v) {
    if (done.find(i.first) != done.end()) continue;
    long long oth = (inv((-i.first + MOD) % MOD) + MOD) % MOD;
    long long cur = (t[i.second] + t[v[oth]]) % MOD;
    cur--;
    res *= cur;
    res %= MOD;
    done.insert(i.first);
    done.insert(oth);
  }
  cout << res - 1;
  return 0;
}
