#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 1e9 + 7;

template <int MOD=1000000007>
struct Modular {
  int value;
  static const int MOD_value = MOD;

  Modular(long long v = 0) { value = v % MOD; if (value < 0) value += MOD;}
  Modular(long long a, long long b) : value(0){ *this += a; *this /= b;}

  Modular& operator+=(Modular const& b) {value += b.value; if (value >= MOD) value -= MOD; return *this;}
  Modular& operator-=(Modular const& b) {value -= b.value; if (value < 0) value += MOD;return *this;}
  Modular& operator*=(Modular const& b) {value = (long long)value * b.value % MOD;return *this;}

  friend Modular mexp(Modular a, long long e) {
    Modular res = 1; while (e) { if (e&1) res *= a; a *= a; e >>= 1; }
    return res;
  }
  friend Modular inverse(Modular a) { return mexp(a, MOD - 2); }

  Modular& operator/=(Modular const& b) { return *this *= inverse(b); }
  friend Modular operator+(Modular a, Modular const b) { return a += b; }
  friend Modular operator-(Modular a, Modular const b) { return a -= b; }
  friend Modular operator-(Modular const a) { return 0 - a; }
  friend Modular operator*(Modular a, Modular const b) { return a *= b; }
  friend Modular operator/(Modular a, Modular const b) { return a /= b; }
  friend std::ostream& operator<<(std::ostream& os, Modular const& a) {return os << a.value;}
  friend bool operator==(Modular const& a, Modular const& b) {return a.value == b.value;}
  friend bool operator!=(Modular const& a, Modular const& b) {return a.value != b.value;}
};

int32_t main() {
  ios::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);

  int n;
  cin >> n;
  
  int bo = 0, l = 0, r = 0;
  map<pair<int, int>, int> m;

  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    if (!a && !b) ++bo;
    else if (!a) ++l;
    else if (!b) ++r;
    else {
      if (a < 0) a *= -1, b *= -1;
      int g = abs(__gcd(a, b));
      m[{a/g, b/g}]++;
    }
  }
  
  Modular<> ans = (bo + 1), two = 2;
  ans = ans * (mexp(two, l) + mexp(two, r) - 1);

  for (auto s : m) {
    int a = s.first.first, b = s.first.second, na = abs(b), nb = a;
    if (b > 0) nb *= -1;
    if (m.count({na, nb})) {
      if (b > 0) ans = ans * (mexp(two, m[{a,b}]) + mexp(two, m[{na,nb}]) - 1);
    } else ans = ans * mexp(two, m[{a, b}]);
  }
  cout << ans-1 << '\n';
}

