#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
static const double pi = 3.141592653589793;
const int mod = 1000000007;
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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a; }
};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
  ll N;
  cin >> N;
  vector<ll> A(N), B(N);
  for (ll i = 0; i < (N); ++i) {
    cin >> A[i] >> B[i];
  }
  map<P, int> mp;
  for (ll i = 0; i < (N); ++i) {
    ll a = A[i];
    ll b = B[i];
    if (a == 0 && b != 0) {
      mp[{0, 1}]++;
    } else if (a != 0 && b == 0) {
      mp[{1, 0}]++;
    } else if (a == 0 && b == 0) {
      mp[{0, 0}]++;
    } else {
      if (a < 0) {
        a *= -1;
        b *= -1;
      }
      if (b > 0) {
        ll d = gcd(a, b);
        mp[{a / d, b / d}]++;
      } else {
        ll d = gcd(a, -b);
        mp[{a / d, b / d}]++;
      }
    }
  }
  mint ans = 1;
  for (auto p : mp) {
    ll a = p.first.first;
    ll b = p.first.second;
    ll num1 = p.second;
    if (a == 0 && b == 0) continue;
    ll a2, b2;
    if (b >= 0) {
      a2 = b;
      b2 = -a;
    } else {
      a2 = -b;
      b2 = a;
    }
    ll num2 = mp[{a2, b2}];
    mint mul = 1;
    mul += mint(2).pow(num1) - 1;
    mul += mint(2).pow(num2) - 1;
    ans *= mul;
    mp[{a, b}] = 0;
    mp[{a2, b2}] = 0;
  }
  ans.x += mp[{0, 0}];
  ans.x -= 1;
  cout << ans.x << endl;
}
