#include <bits/stdc++.h>
using namespace std;
int N;
unordered_map<long double, int> num;
long long qexp(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) {
      res = res * x;
      res %= 1000000007;
    }
    y = y >> 1;
    x = x * x;
    x %= 1000000007;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> N;
  for (long long i = 1; i <= long long(N); ++i) {
    long double a, b;
    cin >> a >> b;
    num[a / b]++;
  }
  long long ans = 1;
  for (auto i : num) {
    if (i.first == 0) continue;
    long double x = -(1 / i.first);
    ans *= (qexp(2, num[i.first]) + qexp(2, num[x]) - 1) % 1000000007;
    ans %= 1000000007;
    num[i.first] = num[x] = 0;
  }
  cout << ans - 1;
}
