#include <bits/stdc++.h>
using namespace std;
int MOD = 1000000007;
int64_t gcd(int64_t a, int64_t b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void yakubun(int64_t& a, int64_t& b) {
  if (a == 0 || b == 0) return;
  if (b < 0) {
    a *= -1;
    b *= -1;
  }
  int64_t m = gcd(a, b);
  a /= m;
  b /= m;
}
int main() {
  int N;
  cin >> N;
  int ans00 = 0;
  vector<int64_t> A;
  vector<int64_t> B;
  map<pair<int, int>, pair<int, int>> AB;
  set<pair<int, int>> key;
  for (int i = 0; i < (int)(N); i++) {
    int64_t a, b;
    cin >> a >> b;
    A.push_back(a);
    B.push_back(b);
    if (a == 0 && b == 0) {
      ans00++;
      continue;
    }
    if (b == 0) {
      a = 1;
      b = 0;
    }
    yakubun(a, b);
    int aj = b;
    int bj = abs(a);
    if (a > 0) aj *= -1;
    if (AB[{aj, bj}].first != 0) {
      AB[{aj, bj}].second++;
    } else {
      AB[{a, b}].first++;
      key.insert({a, b});
    }
  }
  int64_t ans = 1;
  for (auto k : key) {
    cout << k.first << "," << k.second << ":" << AB[k].first << ","
         << AB[k].second << endl;
    int64_t tmp =
        ((int)pow(2, AB[k].first) + (int)pow(2, AB[k].second) - 1) % MOD;
    cout << tmp << endl;
    ans *= tmp;
    ans %= MOD;
  }
  cout << ans + ans00 - 1;
  return 0;
}
