#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
double a[220000], b[220000];
map<double, long long> mp;
const ll mod = 1000000007;
ll f[2200000];
ll invf[2200000];
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
ll nCm(ll n, ll m) { return ((f[n] * invf[m]) % mod) * invf[n - m] % mod; }
signed main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < (n); i++) {
    cin >> a[i] >> b[i];
    double hoge = -b[i] / a[i];
    printf("hoge = %lf\n", hoge);
    mp[hoge]++;
  }
  long long ans = modpow(2LL, n, mod) - 1LL;
  long long res = 0;
  for (long long i = 0; i < (n); i++) {
    double tmp = a[i] / b[i];
    long long k = mp[tmp];
    res += modpow(2LL, n - 1, mod) - modpow(2, n - k, mod);
    double x = -b[i] / a[i];
    mp[x]--;
  }
  ans -= res;
  ans %= mod;
  if (ans < 0) ans += mod;
  ans %= mod;
  cout << ans << endl;
  return 0;
}
