#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5, mod = 1e9 + 7;
map<long double, int> mp;
int n;
long long a[N], b[N], ans = 1, pw[N];
long long sum(long long a, long long b) {
  a %= mod, b %= mod;
  a = (a + b) % mod;
  a = (a + mod) % mod;
  return a;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  pw[0] = 1;
  for (int i = 1; i < N; i++) pw[i] = (1LL * pw[i - 1] * 2) % mod;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    long double k = -a[i] / b[i];
    int cnt = mp[k];
    ans = sum(ans, 1LL * sum(pw[cnt], -1) * pw[i - cnt] % mod);
    k = b[i] / a[i];
    mp[k]++;
  }
  ans = sum(pw[n], -ans);
  cout << ans << "\n";
}
