#include <bits/stdc++.h>
using namespace std;
string ans_Yes = "Yes";
string ans_No = "No";
string ans_yes = "yes";
string ans_no = "no";
double A[1000000];
double B[1000000];
long long C;
long long N;
long long M;
long long K;
long long getPower(long long value, long long shisu, long long mod) {
  long long ans = 1;
  long long cnt = shisu;
  while (cnt > 0) {
    if (cnt % 2 == 1) {
      ans = ans * value % mod;
    }
    value = value * value % mod;
    cnt = cnt / 2;
  }
  return ans;
}
long long ans = 1;
int main() {
  cin >> N;
  for (int ni = 0; ni < (N); ni++) {
    cin >> A[ni];
    cin >> B[ni];
  }
  map<string, long long> count_map[2];
  map<string, string> conv;
  int m_std = 0;
  int m_rev = 1;
  long long count_both_0 = 0;
  count_map[m_std]["0"] = 0;
  count_map[m_rev]["0"] = 0;
  conv["0"] = "0";
  for (int ni = 0; ni < (N); ni++) {
    if (A[ni] == 0 && B[ni] == 0) {
      count_both_0++;
    } else {
      if (A[ni] == 0) {
        count_map[m_std]["0"]++;
      } else if (B[ni] == 0) {
        count_map[m_rev]["0"]++;
      } else {
        string index1 = to_string(A[ni] / B[ni]);
        string index2 = to_string(-1 * B[ni] / A[ni]);
        if (count_map[m_rev].count(index1) == 1) {
          count_map[m_rev][index1]++;
        } else {
          if (count_map[m_std].count(index1) == 1) {
            count_map[m_std][index1]++;
          } else {
            count_map[m_std][index1] = 1;
            count_map[m_rev][index2] = 0;
            conv[index1] = index2;
          }
        }
      }
    }
  }
  long long ans = 1;
  for (auto x : count_map[m_std]) {
    string key = x.first;
    long long value = x.second;
    long long tmp = 1;
    tmp += getPower(2, value, 1000000007) - 1;
    key = conv[key];
    value = count_map[m_rev][key];
    tmp += getPower(2, value, 1000000007) - 1;
    ans = ans * tmp % 1000000007;
  }
  ans = ans + count_both_0;
  ans = ans - 1;
  ans = ans % 1000000007;
  cout << ans << endl;
}
