#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (!a) {
    return b;
  }
  return gcd(b % a, a);
}
long long bp(long long a, long long b) {
  if (!b) {
    return 1;
  }
  if (b & 1) {
    return ((bp(a, b - 1) * a) % mod);
  } else {
    return (bp((a * a) % mod, b / 2) % mod);
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  long long n;
  cin >> n;
  vector<pair<long long, long long> > a(n);
  map<pair<long long, long long>, pair<long long, long long> > mp;
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    long long g = gcd(a[i].first, a[i].second);
    a[i].first /= g;
    a[i].second /= g;
    if (a[i].second < 0) {
      a[i].first *= -1;
      a[i].second *= -1;
    }
    if (a[i].first < 0) {
      a[i].first *= -1;
      swap(a[i].first, a[i].second);
      mp[a[i]].second++;
    } else {
      mp[a[i]].first++;
    }
  }
  long long r = 1;
  for (auto i = mp.begin(); i != mp.end(); i++) {
    if (i->first == make_pair(0LL, 0LL)) {
      continue;
    }
    long long l = (bp(2, i->second.first % (mod - 2)) +
                   bp(2, i->second.second % (mod - 2))) %
                  mod;
    r *= ((l - 1 + mod) % mod);
    r %= mod;
  }
  cout << (r - 1 + mod) % mod << endl;
}
