#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200005;
const long long MOD = 1e9 + 7;
long long A[MAX_N], B[MAX_N];
vector<pair<long long, long long> > ab;
long long mygcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return mygcd(b, a % b);
}
long long pow2(long long n) {
  if (n == 0) return long long(1);
  if (n == 1) return long long(2);
  if (n % 2 == 0) {
    long long p = pow2(n / 2);
    return p * p % MOD;
  } else {
    return 2 * pow2(n / 2) % MOD;
  }
}
int main() {
  long long N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    long long g = mygcd(abs(A[i]), abs(B[i]));
    A[i] /= g, B[i] /= g;
  }
  long long ans = 1;
  ab.push_back(pair<long long, long long>(A[0], B[0]));
  for (int i = 0; i < N - 1; i++) {
    long long cnt = 0;
    if (A[i + 1] == long long(0) && B[i + 1] == long long(0)) {
      ab.push_back(pair<long long, long long>(A[i + 1], B[i + 1]));
      continue;
    }
    cnt += upper_bound(ab.begin(), ab.end(),
                       pair<long long, long long>(-1 * B[i + 1], A[i + 1])) -
           upper_bound(ab.begin(), ab.end(),
                       pair<long long, long long>(-1 * B[i + 1], A[i + 1]));
    cnt += upper_bound(ab.begin(), ab.end(),
                       pair<long long, long long>(B[i + 1], -1 * A[i + 1])) -
           upper_bound(ab.begin(), ab.end(),
                       pair<long long, long long>(B[i + 1], -1 * A[i + 1]));
    ans = (ans + pow2(i + 1 - cnt)) % MOD;
    ab.push_back(pair<long long, long long>(A[i + 1], B[i + 1]));
  }
  cout << ans << endl;
  return 0;
}
