#include <bits/stdc++.h>
using namespace std;
long long int c[200005];
const long long int mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  if (n == 1)
    cout << n << endl;
  else {
    long long int a[n], b[n];
    map<long double, long long int> mp;
    long double tmp;
    long long int ans = 1;
    for (int i = 0; i < n; i++) {
      ans *= 2;
      ans %= mod;
      c[i] = ans;
    }
    ans--;
    for (int i = 0; i < n; i++) {
      cin >> a[i] >> b[i];
      tmp = (long double)(1.0 * a[i]) / (long double)(1.0 * b[i]);
      mp[tmp]++;
    }
    long long int t;
    for (auto x : mp) {
      if (x.first >= 0) break;
      if (mp[-1.0 / x.first] > 0) {
        t = ((c[x.second - 1] - 1) * (c[mp[-1.0 / x.first] - 1] - 1)) % mod;
        t = (t * (c[n - 1 - x.second - mp[-1.0 / x.first]])) % mod;
        ans += (mod - t);
        ans %= mod;
      }
    }
    cout << ans << endl;
  }
}
