#include <bits/stdc++.h>
using namespace std;
const long long zero = 0;
const long long INF = 3000000000000000000;
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
long long po(long long a, long long b) {
  long long res = 1;
  long long tmp = a;
  while (b > 0) {
    if (b % 2 == 1) res = res * tmp % MOD;
    b = b / 2;
    tmp = tmp * tmp % MOD;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}
int main() {
  long long N;
  cin >> N;
  vector<long long> a(N), b(N);
  for (long long i = 0; i < N; i++) {
    cin >> a[i] >> b[i];
  }
  map<pair<long long, long long>, pair<long long, long long>> M;
  long long tmp;
  long long cnt = 0;
  for (long long i = 0; i < N; i++) {
    if (a[i] < 0 && b[i] < 0) {
      a[i] = -1 * a[i];
      b[i] = -1 * b[i];
    }
    if (b[i] < 0) {
      a[i] = -1 * a[i];
      b[i] = -1 * b[i];
    }
    if (a[i] == 0 && b[i] == 0) {
      cnt += 1;
      continue;
    } else if (b[i] == 0) {
      if (!M.count(make_pair(INF, 0))) {
        M[make_pair(INF, 0)] = make_pair(zero, zero);
      }
      M[make_pair(INF, 0)].first++;
    } else if (a[i] == 0) {
      if (!M.count(make_pair(INF, 0))) {
        M[make_pair(INF, 0)] = make_pair(zero, zero);
      }
      M[make_pair(INF, 0)].second++;
    } else {
      tmp = gcd(a[i], b[i]);
      a[i] = a[i] / tmp;
      b[i] = b[i] / tmp;
      if (a[i] > 0) {
        if (!M.count(make_pair(a[i], b[i]))) {
          M[make_pair(a[i], b[i])] = make_pair(zero, zero);
        }
        M[make_pair(a[i], b[i])].first++;
      } else {
        a[i] = -1 * a[i];
        if (!M.count(make_pair(b[i], a[i]))) {
          M[make_pair(b[i], a[i])] = make_pair(zero, zero);
        }
        M[make_pair(b[i], a[i])].second++;
      }
    }
  }
  long long ans;
  ans = 1;
  for (pair<pair<long long, long long>, pair<long long, long long>> p : M) {
    if (p.second.first == 0) {
      tmp = po(2, p.second.second) % MOD;
    } else if (p.second.second == 0) {
      tmp = po(2, p.second.first) % MOD;
    } else {
      tmp = (po(2, p.second.first) % MOD + po(2, p.second.second) % MOD + MOD -
             1) %
            MOD;
    }
    ans = ans * tmp % MOD;
  }
  ans = (MOD + ans - 1) % MOD;
  ans = (ans + cnt) % MOD;
  printf("%lld\n", ans);
}
