#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const long long M = 1000000007;
long long pow_mod(long long x, long long n) {
  long long ans = 1;
  while (n != 0) {
    if (n & 1) ans = ans * x % M;
    x = x * x % M;
    n = n >> 1;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  vector<double> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  vector<double> c(n);
  for (int i = 0; i < n; i++) c[i] = a[i] / b[i];
  int count = 0;
  long long ans = 0;
  vector<int> kirai(n);
  for (int i = 0; i < n; i++) {
    count = 0;
    for (int j = i + 1; j < n; j++) {
      if (c[i] * c[j] == -1) count++;
    }
    kirai[i] = count;
  }
  for (int i = 0; i < n; i++) {
    ans += pow_mod(2, n - i - 1 - kirai[i]);
  }
  ans %= M;
  cout << ans << endl;
}
