#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  long long n;
  cin >> n;
  vector<long long> A;
  vector<long long> B;
  for (int i = 0; i < (int)(n); i++) {
    long long a, b;
    cin >> a >> b;
    long long g = gcd(a, b);
    a = a / g;
    b = b / g;
    A.push_back(a);
    B.push_back(b);
  }
  vector<long long> bin(n + 1);
  long long fact = 1;
  for (int i = 0; i < (int)(n + 1); i++) {
    bin[i] = fact;
    fact = fact * 2 % MOD;
  }
  long long ans = bin[n] - 1;
  set<pair<long long, long long>> st;
  for (int i = 0; i < (int)(n); i++) {
    long long d = 0;
    long long cnt = i;
    long long a = A[i];
    long long b = B[i];
    auto c1 = make_pair(-b, a);
    auto c2 = make_pair(b, -a);
    auto l1 = st.lower_bound(c1);
    auto u1 = st.upper_bound(c1);
    d += distance(l1, u1);
    auto l2 = st.lower_bound(c2);
    auto u2 = st.upper_bound(c2);
    d += distance(l2, u2);
    st.insert(make_pair(a, b));
    ans = (ans - bin[i - d]) % MOD;
  }
  cout << ans << endl;
  return 0;
}
