#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<long long> pow2(N);
  pow2[0] = 1;
  for (int i = 1; i < N; i++) {
    pow2[i] = 2 * pow2[i - 1] % MOD;
  }
  map<pair<int, int>, int> m;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    int ta = a, tb = b;
    while (ta != 0) {
      tb %= ta;
      swap(ta, tb);
    }
    a /= tb;
    b /= tb;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    m[make_pair(a, b)]++;
  }
  long long ans = 1;
  for (auto &mi : m) {
    if (mi.first.first == 0 && mi.first.second == 0) continue;
    pair<int, int> tmp;
    if (mi.first.second >= 0) {
      tmp.first = mi.first.second;
      tmp.second = -mi.first.first;
    } else {
      tmp.first = -mi.first.second;
      tmp.second = mi.first.first;
    }
    long long ansi = 0;
    ansi += pow2[m[tmp]];
    ansi += pow2[mi.second];
    ans *= ansi - 1;
    ans %= MOD;
    m[tmp] = 0;
    mi.second = 0;
  }
  cout << (ans - 1 + m[make_pair(0, 0)] + MOD) % MOD << endl;
  return 0;
}
