#include <bits/stdc++.h>
using namespace std;
constexpr long long mod = 1e9 + 7;
long long mypow(long long x, long long n) {
  if (n == 0) return 1;
  if (n % 2 == 1) return mypow(x, n - 1) * x % mod;
  long long tmp = mypow(x, n / 2);
  return tmp * tmp % mod;
}
long long mygcd(long long a, long long b) {
  if (a < 0) a *= -1;
  if (b < 0) b *= -1;
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return mygcd(b, a % b);
}
signed main() {
  map<pair<long long, long long>, pair<long long, long long>> mp;
  long long n, a[200000], b[200000];
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i] >> b[i];
  long long ans = 1, cnt = 0;
  for (long long i = 0; i < n; i++) {
    if (b[i] < 0) {
      a[i] *= -1;
      b[i] *= -1;
    }
    if (a[i] == 0 && b[i] == 0) {
      cnt++;
      break;
    }
    long long tmp = mygcd(a[i], b[i]);
    a[i] /= tmp;
    b[i] /= tmp;
    if (a[i] > 0)
      mp[make_pair(a[i], b[i])].first++;
    else
      mp[make_pair(b[i], -a[i])].second++;
  }
  for (auto x : mp)
    ans = ans *
          (mypow(2, x.second.first) + mypow(2, x.second.second) - 1 % mod) %
          mod;
  cout << (ans - 1 + cnt + mod) % mod << endl;
}
