#include <bits/stdc++.h>
using namespace std;
long long MOD = 10000000000 + 7;
const long long mod = 1e9 + 7;
template <int mod>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt &operator+=(const ModInt &p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator-=(const ModInt &p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt &operator*=(const ModInt &p) {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt &operator/=(const ModInt &p) {
    *this *= p.inv();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt &p) const { return x == p.x; }
  bool operator!=(const ModInt &p) const { return x != p.x; }
  ModInt inv() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while (n > 0) {
      if (n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; }
  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  static int get_mod() { return mod; }
};
using mint = ModInt<mod>;
template <typename T>
T gcd(T a, T b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  map<pair<long long, long long>, int> m;
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    long long x, y;
    cin >> x >> y;
    if (x <= 0 && y <= 0) {
      x *= -1;
      y *= -1;
    }
    if (x <= 0 && y >= 0) {
      x *= -1;
      y *= -1;
    }
    if (x == 0 && y == 0) {
      m[make_pair(x, y)]++;
    } else if (x == 0) {
      m[make_pair(0, 1)]++;
    } else if (y == 0) {
      m[make_pair(1, 0)]++;
    } else {
      long long tmp = gcd(abs(x), abs(y));
      x /= tmp;
      y /= tmp;
      m[make_pair(x, y)]++;
    }
  }
  vector<mint> v;
  for (auto x : m) {
    long long now_x = x.first.first;
    long long now_y = x.first.second;
    long long num = x.second;
    long long next_x, next_y;
    if (now_y >= 0) {
      next_x = now_y;
      next_y = now_x * -1;
    } else {
      next_x = now_y * -1;
      next_y = now_x;
    }
    if (m.count(make_pair(next_x, next_y)) == 0) {
      mint tmp2 = 2;
      tmp2 = tmp2.pow(num);
      v.push_back(tmp2);
    } else {
      mint tmp = 0;
      long long num2 = m[make_pair(next_x, next_y)];
      m.erase(make_pair(next_x, next_y));
      mint tmp2 = 2;
      tmp += tmp2.pow(num) - 1;
      tmp += tmp2.pow(num2) - 1;
      tmp += 1;
      v.push_back(tmp);
    }
  }
  mint ans = 1;
  for (int i = 0; i < v.size(); i++) {
    ans *= v[i];
  }
  ans -= 1;
  mint zero_num = m[make_pair(0, 0)];
  mint tmp2 = 2;
  ans += zero_num * (zero_num - 1) * tmp2.inv();
  cout << ans << endl;
}
