#include <bits/stdc++.h>
using namespace std;
long long N;
map<long double, long long> num;
long long pow2[200001];
int32_t 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]++;
  }
  pow2[0] = 1;
  for (long long i = 1; i <= long long(N); ++i)
    pow2[i] = (pow2[i - 1] * 2) % 1000000007;
  long long ans = 1;
  for (auto i : num) {
    if (i.first == 0) continue;
    long double x = -(1 / i.first);
    ans *= (pow2[num[i.first]] + pow2[num[x]] - 1) % 1000000007;
    ans %= 1000000007;
    if (num.find(x) != num.end()) num[x] = 0;
    num[i.first] = 0;
  }
  cout << ans - 1;
}
