#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200010;
const int MOD = 1e9 + 7;
int n;
long long A[MAXN], B[MAXN];
long long gcd(long long x, long long y) {
  if (x < y) {
    swap(x, y);
  }
  if (y == 0) {
    return x;
  }
  return gcd(y, x % y);
}
long long modPow(long long x, long long y) {
  long long res = 1;
  x = x % MOD;
  while (y > 0) {
    if (y & 1) {
      res = (res * x) % MOD;
    }
    y >>= 1;
    x = (x * x) % MOD;
  }
  return res;
}
void solve() {
  map<pair<long long, long long>, long long> m;
  for (int i = 0; i < n; i++) {
    long long d = gcd(abs(A[i]), abs(B[i]));
    if (d > 0) {
      A[i] /= d;
      B[i] /= d;
    }
    if (A[i] < 0) {
      A[i] *= -1;
      B[i] *= -1;
    }
    m[pair<long long, long long>(A[i], B[i])]++;
  }
  long long cnt = 0;
  long long comb = 1;
  long long ans = 0;
  for (auto& x : m) {
    pair<long long, long long> p = x.first;
    if (x.second > 0) {
      long long otherCnt =
          p.second > 0 ? m[pair<long long, long long>(p.second, -p.first)]
                       : m[pair<long long, long long>(-p.second, p.first)];
      if (otherCnt > 0) {
        if (x.second + otherCnt == n) {
          ans++;
        }
        cnt += x.second + otherCnt;
        comb = comb * (modPow(2, x.second) + modPow(2, otherCnt) - 1) % MOD;
      }
      x.second = 0;
    }
  }
  ans += comb * modPow(2, n - cnt) - 1 % MOD;
  cout << ans << endl;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i] >> B[i];
  }
  solve();
}
