#include <bits/stdc++.h>
using namespace std;
long long int binpow(long long int a, long long int b,
                     long long int m = 1000000007) {
  a %= m;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int a[n], b[n];
  for (int x = 0; x < n; x++) cin >> a[x] >> b[x];
  map<long double, long long int> ae;
  long long int d = 1;
  long long int f = 0;
  long long int g = 0;
  for (int x = 0; x < n; x++) {
    if (a[x] == 0 && b[x] == 0) {
      ++g;
      continue;
    }
    if (abs(b[x]) > 0)
      ++ae[(long double)a[x] / b[x]];
    else {
      ++f;
      ae[0] += 0;
    }
  }
  long long int j = 0;
  set<long double> aw;
  for (auto it : ae) {
    long long int w;
    long long int we = 1;
    aw.insert(it.first);
    if (abs(it.first - 0) > 1e-19) {
      long double r = -(long double)1.0 / (long double)it.first;
      if (aw.count(r)) continue;
      w = ae[r];
    } else {
      w = f;
    }
    we = binpow(2, it.second + w);
    we -= (((1000000007 + binpow(2, it.second) - 1) *
            (1000000007 + binpow(2, w) - 1)) %
           1000000007) %
          1000000007;
    we = (1000000007 + we) % 1000000007;
    d *= we;
    d %= 1000000007;
  }
  d %= 1000000007;
  d = (1000000007 + d - 1 + g) % 1000000007;
  cout << d << "\n";
}
