#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int64_t large = 9223372036854775807;
int64_t gcd(int64_t p, int64_t q) {
  if (p < q) swap(p, q);
  if (p % q == 0)
    return q;
  else
    return gcd(q, p % q);
}
int64_t mypow(int64_t x, int64_t y) {
  if (y == 1)
    return x;
  else if (y % 2 == 1)
    return mypow(x, y - 1) * x % mod;
  else {
    int64_t tmp = mypow(x, y / 2);
    return tmp * tmp % mod;
  }
}
int main() {
  int N;
  cin >> N;
  int zero_zero = 0;
  map<pair<int64_t, int64_t>, pair<int64_t, int64_t>> list;
  vector<int64_t> p2(200000);
  p2[0] = 1;
  for (int i = 0; i < 200000; i++) p2[i + 1] = p2[i] * 2 % mod;
  for (int i = 0; i < N; i++) {
    int64_t p, q;
    cin >> p >> q;
    if (p == 0 && q == 0)
      zero_zero++;
    else if (p == 0)
      list[{0, 0}].first++;
    else if (q == 0)
      list[{0, 0}].second++;
    else {
      if (q < 0) p = -p, q = -q;
      int64_t tmp = gcd(abs(p), abs(q));
      p /= tmp, q /= tmp;
      if (p < 0)
        list[{q, -p}].first++;
      else
        list[{p, q}].second++;
    }
  }
  int64_t ans = 1;
  for (auto m : list) {
    int64_t tmp = p2[m.second.first] + p2[m.second.second] - 1;
    ans = ans * tmp % mod;
  }
  cout << (ans - 1 + mod) % mod;
}
