#include <bits/stdc++.h>
using namespace std;
int64_t mod = 1000000007;
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}
int64_t gcd(int64_t a, int64_t b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  if (a % b == 0) return b;
  return gcd(a % b, b);
}
int64_t app() {
  int n;
  cin >> n;
  map<int64_t, map<int64_t, pair<int, int>>> m;
  for (int i = 0; i < (int)(n); i++) {
    int64_t a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      m[a][b].first++;
      continue;
    }
    if (a < 0 || (a == 0 && b < 0)) {
      a = -a;
      b = -b;
    }
    if (b > 0) {
      int64_t g = gcd(a, b);
      a = a / g;
      b = b / g;
      m[a][b].first++;
    } else {
      b = -b;
      swap(a, b);
      int64_t g = gcd(a, b);
      a = a / g;
      b = b / g;
      m[a][b].second++;
    }
  }
  int64_t ans = 1;
  for (auto ma : m) {
    for (auto mb : ma.second) {
      auto p = mb.second;
      if (ma.first == 0 && mb.first == 0) {
        continue;
      } else {
        int64_t k2 = 0;
        int64_t k = 1;
        for (int i = 0; i < (int)(p.first); i++) {
          k *= 2;
          k %= mod;
        }
        k2 += k;
        k = 1;
        for (int i = 0; i < (int)(p.second); i++) {
          k *= 2;
          k %= mod;
        }
        k2 += k;
        k2--;
        ans *= k2;
        ans %= mod;
      }
    }
  }
  ans += m[0][0].first;
  ans--;
  ans %= mod;
  return ans;
}
int main() {
  cout << app() << endl;
  return 0;
}
