#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;
template <int MOD = 1000000007>
struct Mint {
  int x;
  Mint() : x(0) {}
  Mint(long long t) {
    x = t % MOD;
    if (x < 0) x += MOD;
  }
  Mint pow(int n) {
    Mint res(1), t(x);
    while (n > 0) {
      if (n & 1) res *= t;
      t *= t;
      n >>= 1;
    }
    return res;
  }
  Mint inv() const {
    int a = x, b = MOD, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      a -= t * b;
      swap(a, b);
      u -= t * v;
      swap(u, v);
    }
    return Mint(u);
  }
  Mint &operator+=(Mint a) {
    x += a.x;
    if (x >= MOD) x -= MOD;
    return *this;
  }
  Mint &operator-=(Mint a) {
    x += MOD - a.x;
    if (x >= MOD) x -= MOD;
    return *this;
  }
  Mint &operator*=(Mint a) {
    x = int(1LL * x * a.x % MOD);
    return *this;
  }
  Mint &operator/=(Mint a) { return (*this) *= a.inv(); }
  Mint operator+(Mint a) const { return Mint(x) += a; }
  Mint operator-(Mint a) const { return Mint(x) -= a; }
  Mint operator*(Mint a) const { return Mint(x) *= a; }
  Mint operator/(Mint a) const { return Mint(x) /= a; }
  Mint operator-() const { return Mint(-x); }
  bool operator==(const Mint a) { return x == a.x; }
  bool operator!=(const Mint a) { return x != a.x; }
  bool operator<(const Mint a) { return x < a.x; }
  friend ostream &operator<<(ostream &os, const Mint &a) { return os << a.x; }
  friend istream &operator>>(istream &is, Mint &a) {
    int t;
    is >> t;
    a = Mint<MOD>(t);
    return (is);
  }
};
signed main() {
  int n;
  cin >> n;
  long double a[n], b[n];
  for (int i = 0; i < (n); i++) {
    cin >> a[i] >> b[i];
  }
  Mint<> ans = 1;
  map<long double, int> mp;
  for (int i = 0; i < (n); i++) {
    if (mp.count(a[i] / b[i])) {
      ans = ans + ans / Mint<>(2).pow(mp[a[i] / b[i]]);
    } else {
      ans *= 2;
    }
    mp[-b[i] / a[i]]++;
  }
  cout << ans - Mint<>(1) << endl;
  return 0;
}
