#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
long long int repow(long long int n, long long int k, long long int m) {
  if (k == 0)
    return 1;
  else if (k % 2 == 1)
    return repow(n, k - 1, m) * n % m;
  else {
    long long int temp = repow(n, k / 2, m);
    return temp * temp % m;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int A, B, C, D, E, F, N, M, K, L, X, Y, Z, H, W, sum = 0, num = 0,
                                                             flag = 0;
  string S, T;
  cin >> N;
  map<double, int> mp1;
  map<double, int> mp2;
  for (long long int i = 0; i < N; i++) {
    cin >> A >> B;
    if ((double)A / B >= 0)
      mp1[(double)A / B]++;
    else
      mp2[-(double)B / A]++;
  }
  num = 1;
  set<double> st;
  for (auto v : mp1) st.insert(v.first);
  for (auto v : mp2) st.insert(v.first);
  for (auto v : st) {
    if (mp1.find(v) != mp1.end() && mp2.find(v) != mp2.end()) {
      num *= (repow(2, mp1[v], 1000000007)) +
             (repow(2, mp2[v], 1000000007) - 1) % 1000000007;
    } else if (mp1.find(v) != mp1.end()) {
      num *= (mp1[v] + 1);
    } else {
      num *= (mp2[v] + 1);
    }
    num %= 1000000007;
  }
  if (st.size() == 1) num++;
  cout << (num + 1000000007 - 1) % 1000000007 << endl;
}
