#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;
template <typename T>
T gcd(T a, T b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
template <typename T>
T modpower(T a, T n, T mod) {
  T res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  int zero = 0;
  ll res = 1;
  map<pair<ll, ll>, pair<ll, ll> > mp;
  for (int i = 0; i < (int)n; ++i) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
    } else if (a == 0) {
      mp[make_pair(0, 1)].first++;
    } else if (b == 0) {
      mp[make_pair(0, 1)].second++;
    } else {
      ll g = gcd(a, b);
      a /= g, b /= g;
      if (a <= 0) {
        ll tmp = -a;
        a = b, b = tmp;
        mp[make_pair(a, b)].second++;
      } else {
        mp[make_pair(a, b)].first++;
      }
    }
  }
  for (auto m : mp) {
    ll tmp = 1;
    tmp += modpower((ll)2, m.second.first, MOD) - 1;
    tmp += modpower((ll)2, m.second.second, MOD) - 1;
    res *= tmp;
    res %= MOD;
  }
  res += zero;
  cout << res - 1 << endl;
  return 0;
}
