#include <bits/stdc++.h>
using namespace std;
long long INF = LLONG_MAX;
int const mxn = 2e5 + 5;
map<long double, pair<int, int> > mp;
long long modpow(long long a, long long b) {
  long long r = 1;
  while (b) {
    if (b & 1) r = (r * a) % 1000000007;
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return r;
}
void multi(long long &a, long long b) {
  a %= 1000000007;
  b %= 1000000007;
  a *= b;
  a %= 1000000007;
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, b, n;
  cin >> n;
  int zero = 0;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    if (a == 0) {
      mp[0].first++;
      continue;
    }
    if (b == 0) {
      mp[0].second++;
      continue;
    }
    long double now = long double(a) / b;
    mp[now].first++;
    now = -1 / now;
    mp[now].second++;
  }
  long long ans = 1;
  for (auto p : mp) {
    if (p.first > 0) break;
    a = p.second.first;
    b = p.second.second;
    long long now = 1;
    now += modpow(2, a) - 1;
    now += modpow(2, b) - 1;
    multi(ans, now);
  }
  ans -= 1;
  ans += zero;
  cout << ans % 1000000007 << endl;
}
