#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long binpow(long long x, long long k) {
  if (k == 0) {
    return 1LL;
  }
  long long temp = binpow(x, k / 2);
  if (k % 2 == 1) {
    return (((temp * temp) % mod) * x) % mod;
  } else {
    return (temp * temp) % mod;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  cin.tie();
  cout.tie();
  int n;
  cin >> n;
  vector<pair<long long, long long>> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i].first >> v[i].second;
    long long x = gcd(abs(v[i].first), abs(v[i].second));
    v[i].first /= x;
    v[i].second /= x;
    if (v[i].first < 0 || (v[i].first == 0 && v[i].second < 0)) {
      v[i].first *= -1;
      v[i].second *= -1;
    }
  }
  map<pair<long long, long long>, int> mp;
  set<pair<long long, long long>> st;
  for (int i = 0; i < n; i++) {
    mp[v[i]]++;
    st.insert(v[i]);
  }
  long long rez = 1;
  set<pair<long long, long long>> done;
  for (set<pair<long long, long long>>::iterator it = st.begin();
       it != st.end(); it++) {
    if (it->first == 0 && it->second == 0) {
      continue;
    }
    if (done.find(*it) != done.end()) {
      continue;
    }
    pair<long long, long long> val = *it;
    if (val.second < 0) {
      val = {-val.second, val.first};
    }
    rez *= (binpow(2, mp[val]) + binpow(2, mp[{val.second, -val.first}]) - 1) %
           mod;
    rez %= mod;
    done.insert(val);
    done.insert({val.second, -val.first});
  }
  if (done.empty()) {
    cout << "1\n";
  } else {
    cout << rez - 1 << '\n';
  }
  return 0;
}
