#include <bits/stdc++.h>
using namespace std;
long long INF = 1000000007;
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long gcd(long long x, long long y) {
  if (y % x == 0)
    return x;
  else
    return gcd(y % x, x);
}
int main() {
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> mp;
  for (int i = 0; i < (n); i++) {
    long long ai, bi;
    cin >> ai >> bi;
    long long gcdi = gcd(ai, bi);
    ai /= gcdi;
    bi /= gcdi;
    mp[{ai, bi}]++;
    mp[{-ai, -bi}]++;
  }
  map<pair<long long, long long>, int> cnt;
  long long ans = 1;
  vector<long long> anss;
  for (auto i = mp.begin(); i != mp.end(); i++) {
    long long ai = i->first.first;
    long long bi = i->first.second;
    if (cnt[{ai, bi}] == 0 && cnt[{bi, -ai}] == 0) {
      anss.push_back(modpow((long long)2, mp[{ai, bi}], INF) +
                     modpow((long long)2, mp[{bi, -ai}], INF) - (long long)1);
      cnt[{ai, bi}]++;
      cnt[{-ai, -bi}]++;
      cnt[{bi, -ai}]++;
      cnt[{-bi, ai}]++;
    }
  }
  for (int i = 0; i < ((int)anss.size()); i++) ans *= anss[i] % INF;
  cout << (ans - (long long)1 + INF) % INF << endl;
}
