#include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX;
const long long INF = 1LL << 60;
const long long mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
  fill((T*)array, (T*)(array + N), val);
}
template <class T1, class T2, class Pred = std::less<T2> >
struct sort_pair_second {
  bool operator()(const std::pair<T1, T2>& left,
                  const std::pair<T1, T2>& right) {
    Pred p;
    return p(left.second, right.second);
  }
};
long long modpow(long long a, long long p) {
  if (p == 0) return 1;
  if (!(p % 2)) {
    long long halfP = p / 2;
    long long half = modpow(a, halfP);
    return half * half % mod;
  } else {
    return a * modpow(a, p - 1) % mod;
  }
}
vector<pair<int, int> > p;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int zero = 0;
  map<pair<long long, long long>, pair<int, int> > mp;
  for (int i = (0); i < (int)(n); i++) {
    long long x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      zero++;
      continue;
    }
    long long g = gcd(x, y);
    x /= g;
    y /= g;
    if (y < 0) {
      x = -x;
      y = -y;
    }
    if (y == 0 && x < 0) {
      x = -x;
      y = -y;
    }
    bool rot90 = (x <= 0);
    if (rot90) {
      double tmp = x;
      x = y;
      y = -tmp;
    }
    if (rot90)
      mp[{x, y}].first++;
    else
      mp[{x, y}].second++;
  }
  long long ans = 1;
  for (auto p : mp) {
    int s = p.second.first;
    int t = p.second.second;
    long long now = 1;
    now += modpow(2, s) - 1;
    now += modpow(2, t) - 1;
    now %= mod;
    ans *= now;
    ans %= mod;
  }
  ans -= 1;
  ans += zero;
  ans %= mod;
  cout << ans << endl;
  return 0;
}
