#include <bits/stdc++.h>
using namespace std;
long long mod_pow(long long n, long long e, long long mod) {
  long long ans = 1;
  n = n % mod;
  while (e != 0) {
    if (e % 2 == 1) {
      ans = (ans * n) % mod;
    }
    e /= 2;
    n = (n * n) % mod;
  }
  return ans;
}
long long my_gcd(long long n, long long m) {
  if (n < 0) n *= -1;
  if (m < 0) m *= -1;
  if (n < m) swap(n, m);
  if (m == 0)
    return n;
  else
    return my_gcd(m, n % m);
}
signed main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> b(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  map<pair<long long, long long>, long long> mp;
  long long aho = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] != 0 && b[i] == 0) {
      if (mp.find(make_pair(1, 0)) != mp.end()) {
        mp[make_pair(1, 0)]++;
      } else
        mp[make_pair(1, 0)] = 1;
    } else if (a[i] == 0 && b[i] != 0) {
      if (mp.find(make_pair(0, 1)) != mp.end()) {
        mp[make_pair(0, 1)]++;
      } else
        mp[make_pair(0, 1)] = 1;
    } else if (a[i] == 0 && b[i] == 0) {
      aho++;
    } else {
      long long g = my_gcd(a[i], b[i]);
      if (a[i] < 0) {
        a[i] *= -1;
        b[i] *= -1;
      }
      pair<long long, long long> p = make_pair(a[i] / g, b[i] / g);
      if (mp.find(p) != mp.end())
        mp[p]++;
      else
        mp[p] = 1;
    }
  }
  long long ans = 1;
  long long mod = 1000000007;
  for (auto itr = mp.begin(); itr != mp.end(); itr++) {
    pair<long long, long long> right;
    if (itr->first.second == 0) {
      right = make_pair(0, 1);
    }
    if (itr->first.first == 0) {
      right = make_pair(1, 0);
    } else if (itr->first.second > 0) {
      right = make_pair(itr->first.second, itr->first.first * -1);
    } else {
      right = make_pair(itr->first.second * (-1), itr->first.first);
    }
    long long m = 0;
    if (mp.find(right) != mp.end()) {
      m = mp[right];
    }
    ans =
        (ans * ((mod_pow(2, itr->second, mod) + mod_pow(2, m, mod) + mod - 1) %
                mod)) %
        mod;
    if (m != 0) mp[right] = 0;
    itr->second = 0;
  }
  cout << ans - 1 + aho << endl;
  return 0;
}
