#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
  long long g = gcd(a, b);
  return a / g * b;
}
long long modpow(long long a, long long p) {
  if (p == 0) return 1;
  if (p % 2 == 0) {
    long long halfP = p / 2;
    long long half = modpow(a, halfP);
    return half * half % 1000000007;
  } else {
    return a * modpow(a, p - 1) % 1000000007;
  }
}
vector<pair<long long, long long> > P;
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  P.resize(N);
  long long zero = 0;
  map<pair<long long, long long>, pair<long long, long long> > mp;
  for (long long i = 0; i < N; i++) {
    cin >> P[i].first >> P[i].second;
    if (P[i].first == 0 && P[i].second == 0) {
      zero++;
      continue;
    }
    long long g = gcd(P[i].first, P[i].second);
    P[i].first /= g;
    P[i].second /= g;
    if (P[i].second < 0) {
      P[i].first *= -1;
      P[i].second *= -1;
    }
    if (P[i].second == 0 && P[i].first < 0) P[i].first *= -1;
    bool rot = false;
    if (P[i].first <= 0) rot = 1;
    if (rot) {
      long long tmp = P[i].first;
      P[i].first = P[i].second;
      P[i].second = -tmp;
    }
    if (rot)
      mp[pair<long long, long long>(P[i].first, P[i].second)].first++;
    else
      mp[pair<long long, long long>(P[i].first, P[i].second)].second++;
  }
  long long ans = 1;
  for (auto &p : mp) {
    long long s = p.second.first;
    long long t = p.second.second;
    long long now = 1;
    now += modpow(2, s) - 1;
    now += modpow(2, t) - 1;
    now = (now + 1000000007) % 1000000007;
    ans *= now;
    ans %= 1000000007;
  }
  ans += zero;
  cout << ans - 1 << endl;
  return 0;
}
