#include <bits/stdc++.h>
using namespace std;
template <class T>
using MINPQ = std::priority_queue<T, vector<T>, greater<T>>;
template <class T>
using MAXPQ = std::priority_queue<T>;
const long long hmod1 = 999999937;
const long long hmod2 = 1000000000 + 9;
const long long INF = 1 << 30;
const long long INFLL = 1LL << 62;
const double EPS = 1e-12;
const long long mod = 1000000000 + 7;
const long long dx4[4] = {0, 0, -1, 1};
const long long dy4[4] = {-1, 1, 0, 0};
const long long dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const long long dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const long double pi = 3.141592653589793;
void dump_func() { cerr << endl; };
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail) {
  cerr << head;
  if (sizeof...(Tail) == 0)
    cerr << " ";
  else
    cerr << ", ";
  dump_func(std::move(tail)...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  os << "[";
  for (long long i = 0; i < vec.size(); i++)
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  os << "]";
  return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
  os << "[";
  for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
    os << "(" << itr->first << ", " << itr->second << ")";
    itr++;
    if (itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "]";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
  os << "[";
  for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
    os << *itr;
    ++itr;
    if (itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "]";
  return os;
}
long long n;
map<pair<long long, long long>, vector<long long>> s1, s2;
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 powmod(long long n, long long k) {
  if (k < 0) return 0;
  if (k == 0)
    return 1;
  else if (k % 2 == 0) {
    long long tmp = powmod(n, k / 2);
    return tmp * tmp % mod;
  } else
    return powmod(n, k - 1) * n % mod;
}
long long inverse(long long n) { return powmod(n, mod - 2); }
long long a[200000 + 5], b[200000 + 5];
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (long long i = 0; i < (n); i++) {
    cin >> a[i] >> b[i];
    if (a[i] < 0 && b[i] < 0) {
      a[i] *= -1;
      b[i] *= -1;
    }
    long long g = gcd(abs(a[i]), abs(b[i]));
    if (g == 0) g++;
    a[i] /= g;
    b[i] /= g;
    s1[{a[i], b[i]}].push_back(i);
    s2[{-b[i], a[i]}].push_back(i);
    s2[{b[i], -a[i]}].push_back(i);
  }
  long long all = 0;
  for (auto& x : s1) {
    if (s2.find(x.first) == s2.end()) all++;
  }
  long long ans = powmod(2, all);
  cerr << ans << endl;
  set<vector<long long>> S;
  for (auto& x : s1) {
    if (s2.find(x.first) == s2.end()) continue;
    if (S.find(x.second) != S.end()) continue;
    pair<long long, long long> p = x.first;
    long long sz1 = s1[p].size();
    long long sz2 = s2[p].size();
    long long tmp = powmod(2, sz1);
    (tmp) = ((tmp) + ((powmod(2, sz2) - 1) % mod) + mod) % mod;
    ans = (ans * tmp) % mod;
    S.insert(s2[p]);
    long long A = p.first;
    long long B = p.second;
    S.insert(s2[{-B, A}]);
    S.insert(s2[{B, -A}]);
  }
  (ans) = ((ans) + ((-1) % mod) + mod) % mod;
  cout << ans << endl;
}
