#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
ll pwr(ll a, ll b);
const int N = 2e5 + 10;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
int n;
ll a[N], b[N], g, x, y;
void add_self(ll &a, ll b) {
  a += b;
  if (a >= mod) a -= mod;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int c0 = 0;
  map<pair<ll, ll>, int> mp;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 and b[i] == 0)
      c0++;
    else {
      if (b[i] < 0) a[i] *= -1LL, b[i] *= -1LL;
      g = gcd(abs(a[i]), abs(b[i]));
      mp[{a[i] / g, b[i] / g}]++;
    }
  }
  ll ans = 0;
  ans += c0;
  vector<pair<int, int> > comp;
  comp.push_back({mp[{1, 0}], mp[{0, 1}]});
  for (auto it : mp) {
    if (it.first.first == 0 or it.first.second == 0) {
      continue;
    } else {
      x = it.first.first, y = it.first.second;
      if (x < 0) {
        comp.push_back({it.second, mp[{y, -x}]});
        mp.erase(mp.find({y, -x}));
      } else {
        comp.push_back({it.second, mp[{-y, x}]});
        mp.erase(mp.find({-y, x}));
      }
    }
  }
  ll ta = 1LL, tb = 0LL;
  for (auto it : comp) {
    tb = pwr(2, it.first) % mod;
    add_self(tb, pwr(2, it.second));
    tb = (tb - 1LL + mod) % mod;
    ta = (ta % mod * tb % mod) % mod;
  }
  ta = (ta - 1 + mod) % mod;
  ans = (ans + ta) % mod;
  cout << ans << "\n";
}
ll pwr(ll a, ll b) {
  a %= mod;
  ll res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
