#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll mod = 1000000007;
const double eps = 1E-18;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
struct V {
  double x, y;
  V(double x = 0, double y = 0) : x(x), y(y) {}
  V& operator+=(const V& v) {
    x += v.x;
    y += v.y;
    return *this;
  }
  V operator+(const V& v) const { return V(*this) += v; }
  V& operator-=(const V& v) {
    x -= v.x;
    y -= v.y;
    return *this;
  }
  V operator-(const V& v) const { return V(*this) -= v; }
  V& operator*=(double s) {
    x *= s;
    y *= s;
    return *this;
  }
  V operator*(double s) const { return V(*this) *= s; }
  V& operator/=(double s) {
    x /= s;
    y /= s;
    return *this;
  }
  V operator/(double s) const { return V(*this) /= s; }
  double dot(const V& v) const { return x * v.x + y * v.y; }
  double cross(const V& v) const { return x * v.y - v.x * y; }
  double norm2() const { return x * x + y * y; }
  double norm() const { return sqrt(norm2()); }
  V rotate90() const { return V(y, -x); }
  int ort() const {
    if (abs(x) < eps && abs(y) < eps) return 0;
    if (y > 0)
      return x > 0 ? 1 : 2;
    else
      return x > 0 ? 4 : 3;
  }
  bool operator<(const V& v) const {
    int o = ort(), vo = v.ort();
    if (o != vo) return o < vo;
    return cross(v) > 0;
  }
};
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool eq[200005];
int main() {
  ll n;
  cin >> n;
  ll special = 0;
  vector<P> v;
  for (int i = (0); i < (n); ++i) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      special++;
      continue;
    }
    if (a == 0) {
      b = 1;
      v.emplace_back(a, b);
      continue;
    }
    if (b == 0) {
      a = 1;
      v.emplace_back(a, b);
      continue;
    }
    if (b < 0) {
      a *= -1;
      b *= -1;
    }
    ll c = gcd(abs(a), abs(b));
    a /= c;
    b /= c;
    v.emplace_back(a, b);
  }
  n -= special;
  map<P, P> mp;
  for (int i = (0); i < (n); ++i) {
    ll x = v[i].first;
    ll y = v[i].second;
    if (x > 0) {
      mp[P(x, y)].first++;
      continue;
    }
    if (x == 0) {
      mp[P(1, 0)].second++;
      continue;
    }
    mp[P(y, -x)].second++;
  }
  mint ans(1);
  for (auto m : mp) {
    ll num1 = m.second.first;
    ll num2 = m.second.second;
    mint add = mint(1);
    add += (mint(2).pow(num1) - 1);
    add += (mint(2).pow(num2) - 1);
    ans *= add;
  }
  if (special > 0) {
    ans *= mint(special + 1);
  }
  ans -= mint(1);
  cout << ans.x << endl;
  return 0;
}
