#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll X = 1e9 + 7;
ll modpow(ll n, ll m) {
  if (m == 1) return n % X;
  if (m % 2 == 1) return (modpow(n, m - 1) * n) % X;
  ll t = modpow(n, m / 2);
  return (t * t) % X;
}
int main() {
  int n;
  cin >> n;
  ll a[n], b[n];
  for (int i = 0; i < (n); ++i) {
    cin >> a[i] >> b[i];
  }
  map<double, int> m;
  for (int i = 0; i < (n); ++i) {
    if (b[i] != 0) {
      ++m[(double)a[i] / b[i]];
    } else {
      ++m[0] = 0;
    }
  }
  ll res = modpow(2, n);
  for (int i = 0; i < (n); ++i) {
    double k;
    if (a[i] != 0) {
      k = (double)b[i] / a[i];
    } else {
      k = 0;
    }
    res -= modpow(2, n - m[-k]);
    res %= X;
  }
  return 0;
}
