#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init) \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T>
using VEC = std::vector<T>;
template <class T>
using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail>
void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec) os << v << ",";
  os << "}";
  return os;
}
template <typename T>
ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m) os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}
long long gcd(long long a, long long b) { /* the greatest common divisor*/
  while (b != 0) {
    long long r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long lcm(long long a, long long b) { /*the least common multiple*/
  return (a / gcd(a, b)) * b;
}

// ABC129 https://youtu.be/L8grWxBlIZ4?t=9860
struct ModInt {
  static const int MOD = 1000000007;
  long long x;
  ModInt(long long x = 0) : x((x % MOD + MOD) % MOD) {}
  ModInt &operator+=(const ModInt a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator-=(const ModInt a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt &operator*=(const ModInt a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  ModInt operator+(const ModInt a) const {
    ModInt res(*this);
    return res += a;
  }
  ModInt operator-(const ModInt a) const {
    ModInt res(*this);
    return res -= a;
  }
  ModInt operator*(const ModInt a) const {
    ModInt res(*this);
    return res *= a;
  }
  bool operator==(const ModInt a) const {
    return this->x == a.x && this->MOD == a.MOD;
  }
  bool operator!=(const ModInt a) const {
    return this->x != a.x || this->MOD != a.MOD;
  }
  ModInt pow(long long t) const {
    if (!t) return 1;
    ModInt a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  // for prime MOD
  ModInt inv() const {
    // オイラーの定理より
    // https://ja.wikipedia.org/wiki/%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%A9%E9%80%86%E6%95%B0
    return pow(MOD - 2);
  }
  // for prime MOD
  ModInt &operator/=(const ModInt a) { return (*this) *= a.inv(); }

  // for prime MOD
  ModInt operator/(const ModInt a) const {
    ModInt res(*this);
    return res /= a;
  }
};
std::ostream &operator<<(std::ostream &os, const ModInt &a) {
  os << a.x;
  return os;
}
ModInt Combination(long long n, long long k) {
  // simple algorithm
  ModInt res = 1;
  for (long long i = 1; i < k + 1; i++) {
    ModInt a = n - i + 1;
    res *= a / i;
  }
  return res;
}
ModInt Sum2ko(long long n) {
  // k=0 to k=n
  return ModInt(2).pow(n);
}

map<pair<LL, LL>, LL> m;
LL InvNum(LL a, LL b) {
  DUMP("invnum", a, b, m[{-b, a}], m[{b, -a}]);
  return m[{-b, a}] + m[{b, -a}];
}

int main() {
  int N;
  cin >> N;
  REP(i, 0, N) {
    LL a, b;
    cin >> a >> b;
    LL g = gcd(a, b);
    m[{a / g, b / g}]++;
  }
  DUMP(m);

  LL sum1 = 0;
  VEC<pair<LL, LL>> uns(0);
  for (auto &e : m) {
    auto &v = e.first;
    auto &num = e.second;
    auto invnum = InvNum(v.first, v.second);
    DUMP(v, num, invnum);
    if (invnum == 0) {
      sum1++;
    } else {
      uns.push_back({num, invnum});
    }
  }
  DUMP("HI", m[{-2,1}], m[{1,2}]);

  ModInt g1 = Sum2ko(sum1);
  for (auto &e : uns) {
    auto p1 = Sum2ko(e.first);
    auto p2 = Sum2ko(e.second);

    g1 = g1 * (p1 + p2);
  }

  cout << g1 << endl;

  return 0;
}
