#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
constexpr long long mod = 1000000007LL;
long long modpow(long long a, long long b) {
  if (b == 0) return 1;
  long long tmp = modpow(a, b / 2);
  if (b % 2) return tmp * tmp % mod * a % mod;
  return tmp * tmp % mod;
}
long long gcd(long long a, long long b) {
  if (b > a) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
using p = pair<long long, long long>;
void make_good(p& xy) {
  if (xy.first < 0) xy.first *= -1, xy.second *= -1;
  if (xy.first == 0)
    xy.second = 1;
  else if (xy.second == 0)
    xy.first = 1;
  else {
    long long g = gcd(abs(xy.first), abs(xy.second));
    xy.first /= g;
    xy.second /= g;
  }
}
int main() {
  int N;
  cin >> N;
  map<p, long long> cnt;
  long long res = 0;
  for (int i = 0; i < N; ++i) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ++res;
      continue;
    }
    p tmp = make_pair(a, b);
    make_good(tmp);
    cnt[tmp]++;
    p opp(tmp.second, -tmp.first);
    make_good(opp);
    cnt[opp];
  }
  long long res_tmp = 1;
  map<p, long long> _cnt = cnt;
  for (auto& e : _cnt) {
    p xy = e.first;
    if (xy.second < 0) continue;
    long long c1 = e.second;
    p opp(xy.second, -xy.first);
    make_good(opp);
    long long c2 = cnt[opp];
    res_tmp =
        (res_tmp * ((modpow(2LL, c1) + modpow(2LL, c2) - 1 + mod) % mod)) % mod;
  }
  res_tmp = (res_tmp - 1 + mod) % mod;
  res = (res + res_tmp) % mod;
  cout << res << endl;
  return 0;
}
