#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long gcd(long long N, long long M) {
  while (true) {
    if (min(N, M) == 0) {
      return max(N, M);
    } else if (N > M) {
      N %= M;
    } else {
      M %= N;
    }
  }
}
int main() {
  int N;
  cin >> N;
  map<pair<long long, long long>, long long> m;
  long long ans = 1;
  for (int i = 0; i < N; i++) {
    long long A, B;
    cin >> A >> B;
    long long g = gcd(abs(A), abs(B));
    A /= g;
    B /= g;
    if (A < 0) {
      A = -A;
      B = -B;
    }
    pair<long long, long long> key = make_pair(A, B);
    if (m.count(key)) {
      m[key]++;
    } else {
      m[key] = 1;
    }
  }
  vector<long long> p2(200001, 1);
  for (int i = 0; i < 200000; i++) {
    p2[i + 1] = 2 * p2[i];
    p2[i + 1] %= MOD;
  }
  for (auto &kv : m) {
    pair<long long, long long> key = kv.first;
    long long val = kv.second;
    m[key] = 0;
    pair<long long, long long> inv_key;
    if (key.second < 0) {
      inv_key = make_pair(-key.second, key.first);
    } else {
      inv_key = make_pair(key.second, -key.first);
    }
    long long inv_val = 0;
    if (m.count(inv_key)) {
      inv_val = m[inv_key];
      m[inv_key] = 0;
    }
    ans *= (p2[val] + p2[inv_val] - 1) % MOD;
    ans %= MOD;
  }
  cout << ans - 1 << '\n';
}
