#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 100100100100;
const long long MOD = 1000000007;
long long mod_pow(long long N, long long M) {
  if (M == 0) return 1;
  long long res = mod_pow((N * N) % MOD, M / 2);
  if (M & 1) res = (res * N) % MOD;
  return res %= MOD;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int main() {
  long long N;
  cin >> N;
  long long all = mod_pow(2, N);
  map<pair<long long, long long>, long long> M;
  for (int i = 0; i < N; i++) {
    long long A, B;
    cin >> A >> B;
    long long div = abs(gcd(A, B));
    M[make_pair(A / div, B / div)]++;
  }
  long long minus = 0;
  for (auto p : M) {
    long long bunbo = p.first.first;
    long long bunsi = p.first.second;
    long long X = p.second;
    minus += M[make_pair(bunsi * -1, bunbo)] * X;
    minus %= MOD;
    minus += M[make_pair(bunsi, bunbo * -1)] * X;
    minus %= MOD;
    all -= minus;
    all %= MOD;
    minus = 0;
    if (all < 0) all += MOD;
  }
  cout << all << endl;
}
