#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  long long i, j, h;
  long long Q, K, P, C, N, X, A, B;
  long double H, M, kh, km;
  string S;
  map<long double, long long> m;
  vector<long long> c(2 * pow(10, 5) + 10);
  long long count;
  cin >> N;
  long long ccc = 0;
  for (int i = 0; i < N; i++) {
    cin >> A >> B;
    if (m[A / B] == 0) {
      count++;
      m[-B / A]++;
      if (m[A / B] != 0) ccc++;
      c[m[A / B]]++;
    } else {
      m[-B / A]++;
      if (m[A / B] != 0) ccc++;
      c[m[A / B]]++;
    }
  }
  long long ans = 1;
  for (int i = 1; i < N; i++) {
    if (c[i] != 0) {
      ans = (ans * long long(pow(pow(2, i) + 1, c[i]))) % MOD;
    }
  }
  long long temp = 1;
  for (int i = 0; i < N - ccc; i++) {
    temp = temp * 2 % MOD;
  }
  ans = (temp * ans - 1) % MOD;
  cout << ans << endl;
  return 0;
}
