#include <bits/stdc++.h>
using namespace std;
bool debug_disabled = false;
const int MOD = 1000000007;
pair<long long, long long> ps[200010];
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long mod_pow(long long a, long long b) {
  if (b == 0) return 1;
  long long half = mod_pow(a, b / 2);
  long long res = (half * half) % MOD;
  if (b % 2 != 0) res = (res * a) % MOD;
  return res;
}
void solve() {
  int N;
  cin >> N;
  map<pair<long long, long long>, int> counts;
  int num_zero_cnt = 0, den_zero_cnt = 0;
  for (int i = 0; i < N; ++i) {
    long long ai, bi;
    cin >> ai >> bi;
    if (ai == 0 && bi == 0) continue;
    if (ai == 0) {
      ++num_zero_cnt;
      continue;
    } else if (bi == 0) {
      ++den_zero_cnt;
      continue;
    }
    if (ai < 0 && bi < 0) {
      ai = -ai;
      bi = -bi;
    } else if (ai > 0 && bi < 0) {
      ai = -ai;
      bi = -bi;
    }
    long long mod_ai = ai > 0 ? ai : -ai;
    long long mod_bi = bi > 0 ? bi : -bi;
    long long g = gcd(mod_ai, mod_bi);
    ai /= g;
    bi /= g;
    ps[i] = pair<long long, long long>(ai, bi);
    ++counts[ps[i]];
  }
  long long res =
      (mod_pow(2, num_zero_cnt) + mod_pow(2, den_zero_cnt) + MOD - 1) % MOD;
  while (!counts.empty()) {
    auto first = counts.begin();
    counts.erase(first);
    pair<long long, long long> cur = first->first;
    int cnt = first->second;
    long long tres = mod_pow(2, cnt);
    pair<long long, long long> to_find;
    if (cur.first < 0) {
      to_find.first = cur.second;
      to_find.second = -cur.first;
    } else {
      to_find.first = -cur.second;
      to_find.second = cur.first;
    }
    if (counts.find(to_find) != counts.end()) {
      int n_cnt = counts[to_find];
      tres = (tres + mod_pow(2, n_cnt) + MOD - 1) % MOD;
      counts.erase(counts.find(to_find));
    }
    res = (res * tres) % MOD;
  }
  cout << (res + MOD - 1) % MOD << endl;
}
int main() {
  cout.setf(ios::fixed, ios::floatfield);
  cout.setf(ios::showpoint);
  cout.precision(12);
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  int T = 1;
  for (int i = 1; i <= T; ++i) {
    solve();
  }
  return 0;
}
