#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll, ll, ll>>;
using vb = vector<bool>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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; }
ll ngcd(vector<ll> a) {
  ll res = a[0];
  for (ll i = 1; i < a.size() && res != 1; i++) res = gcd(a[i], res);
  return res;
}
ll nlcm(vector<ll> a) {
  ll res = a[0];
  for (ll i = 1; i < a.size(); i++) res = lcm(a[i], res);
  return res;
}
bool is_prime(ll n) {
  if (n < 2) return false;
  for (ll i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
ll digsum(ll n) {
  ll res = 0;
  while (n) res += n % 10, n /= 10;
  return res;
}
ll digcnt(ll n) {
  ll res = 0;
  while (n) res++, n /= 10;
  return res;
}
vector<ll> divisor(ll n) {
  vector<ll> res;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      res.push_back(i);
      if (i != n / i) res.push_back(n / i);
    }
  }
  sort(res.begin(), res.end());
  return res;
}
map<ll, ll> prime_factor(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) ++res[i], n /= i;
  }
  if (n != 1) res[n] = 1;
  return res;
}
ll modpow(ll a, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    (a *= a) %= MOD;
    n >>= 1;
  }
  return res;
}
const ll maxf = 10000000;
ll fact[maxf + 5];
ll ifact[maxf + 5];
void fact_init() {
  fact[0] = 1;
  for (ll i = 1; i <= maxf; i++) fact[i] = (fact[i - 1] * i) % MOD;
  ifact[maxf] = modpow(fact[maxf], MOD - 2);
  for (ll i = maxf; i >= 1; i--) ifact[i - 1] = (ifact[i] * i) % MOD;
}
ll comb(ll n, ll r) {
  if (n < r || n < 0 || r < 0) return 0;
  if (fact[0] == 0) fact_init();
  return ((fact[n] * ifact[n - r]) % MOD * ifact[r]) % MOD;
}
ll naive_comb(ll n, ll r) {
  ll res = 1;
  for (ll i = n; i > n - r; i--) res = res * i % MOD;
  for (ll i = 1; i <= r; i++) res = (res * modpow(i, MOD - 2)) % MOD;
  return res;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  map<pll, pll> mp;
  ll zero = 0;
  for (long long i = (long long)(0); i < (long long)(n); ++i) {
    ll x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      zero++;
      continue;
    }
    ll g = gcd(x, y);
    x /= g;
    y /= g;
    if (y < 0) x = -x, y = -y;
    if (y == 0 && x < 0) x = -x, y = -y;
    bool rot90 = (x <= 0);
    if (rot90) {
      ll tmp = x;
      x = y;
      y = -tmp;
    }
    if (rot90)
      mp[{x, y}].first++;
    else
      mp[{x, y}].second++;
  }
  ll ans = 1;
  for (auto e : mp) {
    ll s = e.second.first;
    ll t = e.second.second;
    ll now = 1;
    (now += modpow(2, s) + MOD - 1) %= MOD;
    (now += modpow(2, t) + MOD - 1) %= MOD;
    (ans *= now) %= MOD;
  }
  ans = (ans + MOD - 1) % MOD;
  cout << ans << endl;
}
