#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

template <std::uint_fast64_t Modulus>
class modint {
  using u64 = std::uint_fast64_t;

 public:
  u64 a;

  constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {}
  constexpr u64 &value() noexcept { return a; }
  constexpr const u64 &value() const noexcept { return a; }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    u64 exp = Modulus - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }
};

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
constexpr ll INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
constexpr ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, a[ohara], b[ohara], c, d, tmp, m, h, w, x, y, sum, k, q;
map<ld, ll> le, ri, mem;
ll rui[ohara];
ld inf = (ld)1000000000000000100.0;

int main(void) {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);

  using mint = modint<MOD>;

  cin >> n;
  rui[0] = 1;
  rrep(i, 1, n + 10) {
    rui[i] = rui[i - 1] * 2;
    rui[i] %= MOD;
  }
  rep(i, n) cin >> a[i] >> b[i];
  rep(i, n) {
    if (a[i] == 0 || b[i] == 0) return -1;
    ld curr;
    if (b[i] == 0) {
      if (a[i] > 0)
        curr = inf;
      else if (a[i] < 0)
        curr = inf * (ld)-1.0;
      else
        curr = (ld)0.0;

    } else
      curr = (ld)a[i] / (ld)b[i];
    le[curr]++;
    if (a[i] == 0) {
      if (b[i] > 0)
        curr = inf;
      else if (b[i] < 0)
        curr = inf * (ld)-1.0;
      else
        curr = (ld)0.0;
    } else
      curr = (ld)b[i] / (ld)a[i];
    ri[curr]++;
  }
  mint ans = mint(1);
  rep(i, n) {
    ld curr1, curr2, ch;
    mint kake;
    if (b[i] == 0) {
      if (a[i] > 0)
        curr1 = inf;
      else if (a[i] < 0)
        curr1 = inf * (ld)-1.0;
      else
        curr1 = (ld)0.0;

    } else
      curr1 = (ld)a[i] / (ld)b[i];
    if (a[i] == 0) {
      if (b[i] > 0)
        ch = inf;
      else if (b[i] < 0)
        ch = inf * (ld)-1.0;
      else
        ch = (ld)0.0;
    } else
      ch = (ld)b[i] / (ld)a[i];
    curr2 = curr1 * (ld)-1.0;
    if (le[curr1] == 0 || mem[ch]) continue;
    // cout << curr2 << " " << ri[curr2] << "\n";
    if (ri[curr2] == 0) {
      kake = mint(rui[le[curr1]]);
      ans *= kake;
      le[curr1] = 0;
    } else {
      kake = mint(rui[le[curr1]]);
      kake -= mint(1);
      kake += mint(rui[ri[curr2]]);
      ans *= kake;
      le[curr1] = 0;
      mem[curr2] = 1;
    }
  }
  ans -= mint(1);
  Cout(ans.value());
  return 0;
}