#include <bits/stdc++.h>
using namespace std;
using namespace std;
template <typename T>
void cmpmax(T& reference, T value) {
  reference = max(reference, value);
}
template <typename T>
void cmpmin(T& reference, T value) {
  reference = min(reference, value);
}
const long long mod = 1000000007;
static const long long INF = 1e15;
long long mpow(long long x, long long n) {
  long long ans = 1;
  x %= mod;
  while (n != 0) {
    if (n & 1) ans = ans * x % mod;
    x = x * x % mod;
    n = n >> 1;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  while (b) a %= b, swap(a, b);
  return abs(a);
}
int main() {
  long long n;
  cin >> n;
  vector<long long> as(n), bs(n);
  map<pair<long long, long long>, int> norm;
  for (long long i = 0; i < n; i++) {
    cin >> as[i] >> bs[i];
    auto val = gcd(as[i], bs[i]);
    as[i] /= val;
    bs[i] /= val;
    if (as[i] < 0) {
      as[i] *= -1;
      bs[i] *= -1;
    }
    norm[make_pair(as[i], bs[i])]++;
  }
  set<pair<long long, long long> > visit;
  long long sum = 1;
  for (auto p : norm) {
    auto key = p.first;
    if (visit.count(key)) continue;
    visit.insert(key);
    auto f1 = key.first;
    auto f2 = key.second;
    if (f2 < 0) {
      f1 *= -1;
      f2 *= -1;
    }
    auto invKey = make_pair(f2, -f1);
    visit.insert(invKey);
    int n1 = p.second;
    int n2 = norm[invKey];
    auto c = mpow(2, n1) - 1;
    if (n2) {
      c += mpow(2, n2) - 1;
    }
    c++;
    c %= mod;
    sum *= c;
    sum %= mod;
  }
  sum += mod - 1;
  sum %= mod;
  cout << sum << endl;
  return 0;
}
