#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 30) - 1;
const long long LINF = (1LL << 60) - 1;
pair<long long, long long> get_rev(pair<long long, long long> x) {
  long long a = x.first;
  long long b = x.second;
  if (a < 0)
    return pair<long long, long long>(b, -a);
  else
    return pair<long long, long long>(-b, a);
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
const long long mod = (long long)(1e9 + 7);
int main() {
  int n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
  }
  long long zz = 0;
  long long z_left = 0;
  long long z_right = 0;
  map<pair<long long, long long>, long long> mp;
  for (int i = 0; i < n; ++i) {
    if (a[i] == 0 && b[i] == 0)
      zz++;
    else if (a[i] == 0)
      z_left++;
    else if (b[i] == 0)
      z_right++;
    else {
      long long g = gcd(abs(a[i]), abs(b[i]));
      if (b[i] > 0) {
        mp[pair<long long, long long>(a[i] / g, b[i] / g)]++;
      } else {
        mp[pair<long long, long long>(-a[i] / g, -b[i] / g)]++;
      }
    }
  }
  long long res = modpow(2, z_left, mod) + modpow(2, z_right, mod) - 1;
  res %= mod;
  set<pair<long long, long long> > used;
  for (auto &x : mp) {
    if (used.count(x.first)) continue;
    pair<long long, long long> p = x.first;
    pair<long long, long long> p_rev = get_rev(p);
    if (mp.count(p_rev)) {
      res *= modpow(2, mp[p], mod) + modpow(2, mp[p_rev], mod) - 1;
      res %= mod;
      used.insert(p_rev);
    } else {
      res *= modpow(2, mp[p], mod);
      res %= mod;
    }
  }
  res += zz;
  res--;
  res %= mod;
  cout << res << endl;
}
