#include <bits/stdc++.h>
using namespace std;
long double a, b;
long long n, ans = 1, mod = 1e9 + 7, zero;
map<long double, long long> m;
long long qexp(long long a, long long b) {
  a %= mod;
  long long res = 1, base = a;
  while (b) {
    if (b & 1) {
      res *= base;
      res %= mod;
    }
    base *= base;
    base %= mod;
    b >>= 1;
  }
  return res % mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = (long long)1; i <= (long long)n; i++) {
    cin >> a >> b;
    if (a == 0 and b == 0)
      zero++;
    else
      m[a / b]++;
  }
  for (auto it : m) {
    ans *= (qexp(2, it.second) + qexp(2, m[(long double)(-1) / it.first]) - 1) %
           mod;
    ans %= mod;
    m[it.first] = 0;
    m[(long double)(-1) / it.first] = 0;
  }
  ans += (mod - 1 + zero);
  ans %= mod;
  cout << ans;
}
