#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
map<int, ll> memo;
ll pow2(int p) {
  ll ret = 1LL;
  if (memo[p])
    return memo[p];
  else {
    for (int(i) = 0; (i) < (p); (i)++) {
      memo[i] = ret;
      ret *= 2;
      ret %= mod;
    }
  }
  memo[p] = ret;
  return ret;
}
int main() {
  int n;
  cin >> n;
  ll total = pow2(n);
  total %= mod;
  vector<ll> a, b;
  ll allzeros = 0LL;
  ll bad = 0;
  for (int(i) = 0; (i) < (n); (i)++) {
    ll aa, bb;
    cin >> aa >> bb;
    if (aa == 0 && bb == 0) {
      allzeros++;
    } else {
      a.push_back(aa);
      b.push_back(bb);
    }
  }
  ll bbb = pow2(allzeros) - 1;
  bbb %= mod;
  bbb *= pow2(n - allzeros);
  bbb %= mod;
  bbb -= allzeros;
  bbb %= mod;
  bad += bbb;
  bad %= mod;
  ll azeros = 0LL;
  ll bzeros = 0LL;
  map<double, ll> counter;
  map<double, ll> pcounter;
  for (int(i) = 0; (i) < (a.size()); (i)++) {
    if (a[i] == 0)
      azeros++;
    else if (b[i] == 0)
      bzeros++;
    else {
      double c = (double)a[i] / b[i];
      double pc = (double)b[i] / a[i];
      counter[c]++;
      pcounter[pc]++;
    }
  }
  ll aaaaa = (pow2(azeros) - 1);
  aaaaa %= mod;
  aaaaa *= (pow2(bzeros) - 1);
  aaaaa %= mod;
  aaaaa *= pow2(a.size() - azeros - bzeros);
  aaaaa %= mod;
  bad += aaaaa;
  bad %= mod;
  int remain = n;
  remain -= allzeros;
  remain -= azeros;
  remain -= bzeros;
  for (auto e : counter) {
    double c = e.first;
    if (c > 0) {
      ll count = e.second;
      ll pcount = pcounter[-c];
      remain -= (pcount + count);
      ll zzz = pow2(count) - 1;
      zzz %= mod;
      zzz *= (pow2(pcount) - 1);
      zzz %= mod;
      zzz *= (pow2(remain));
      zzz %= mod;
      bad += zzz;
      bad %= mod;
    }
  }
  total %= mod;
  cout << total - 1 - bad;
}
