#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b != 0) {
    long long t = b;
    b = a % b;
    a = t;
  }
  return a;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, i, j, k, ans, c00 = 0, c0x = 0, cx0 = 0, sign, g, aa, bb,
                             MOD = 1000000007, cc, v, vv;
  cin >> n;
  vector<long long> a(n), b(n);
  map<pair<long long, long long>, pair<long long, long long>> ct;
  for (i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if ((a[i] == 0) && (b[i] == 0))
      c00++;
    else if (a[i] == 0)
      c0x++;
    else if (b[i] == 0)
      cx0++;
    else {
      sign = 1;
      if (a[i] * b[i] < 0) sign = -1;
      a[i] = abs(a[i]);
      b[i] = abs(b[i]);
      g = gcd(a[i], b[i]);
      a[i] /= g;
      b[i] /= g;
      aa = a[i];
      bb = b[i];
      if (sign == -1) {
        a[i] = -a[i];
        bb = -bb;
      }
      bb = -bb;
      if ((ct.find({a[i], b[i]}) == ct.end()) &&
          (ct.find({bb, aa}) == ct.end()))
        ct[{a[i], b[i]}] = {1, 0};
      else if (ct.find({bb, aa}) != ct.end())
        ct[{bb, aa}].second++;
      else
        ct[{a[i], b[i]}].first++;
    }
  }
  vector<long long> pow2(n + 1);
  pow2[0] = 1;
  for (i = 1; i <= n; i++) pow2[i] = (pow2[i - 1] * 2) % MOD;
  ans = c00;
  cc = n - c00 - c0x - cx0;
  v = (pow2[c0x] + pow2[cx0] + MOD - 1) % MOD;
  vv = 1;
  for (auto p : ct) {
    vv = (vv *
          ((pow2[p.second.first] + pow2[p.second.second] + MOD - 1) % MOD)) %
         MOD;
  }
  ans = (ans + v * vv + MOD - 1) % MOD;
  cout << ans << "\n";
  return 0;
}
