#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long long int MAX_N = 500010;
const long long int INF = 999999999999;
map<pair<long long int, long long int>, bool> used;
map<pair<long long int, long long int>, long long int> mp;
long long int modpow(long long int a, long long int n, long long int mod) {
  long long int ret = 1;
  while (n > 0) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
long long int gcd(long long int a, long long int b) {
  long long int M = max(a, b);
  long long int m = min(a, b);
  if (m == 0) {
    return M;
  }
  return gcd(m, M % m);
}
int main() {
  long long int n;
  cin >> n;
  vector<long long int> a(n), b(n);
  for (long long int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] != 0 || b[i] != 0) {
      if (a[i] * b[i] < 0) {
        a[i] = -abs(a[i]);
        b[i] = abs(b[i]);
      } else {
        a[i] = abs(a[i]);
        b[i] = abs(b[i]);
      }
      long long int g = gcd(abs(a[i]), abs(b[i]));
      a[i] /= g;
      b[i] /= g;
      mp[make_pair(a[i], b[i])]++;
    } else {
      mp[make_pair(0, 0)]++;
    }
  }
  long long int ans = 1;
  long long int zero = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0 && b[i] == 0) {
      zero++;
    } else if (!used[make_pair(a[i], b[i])]) {
      used[make_pair(a[i], b[i])] = true;
      if (a[i] > 0) {
        ans *= modpow(2, mp[make_pair(a[i], b[i])], MOD) +
               modpow(2, mp[make_pair(-b[i], a[i])], MOD) - 1;
        used[make_pair(-b[i], a[i])] = true;
      } else {
        ans *= modpow(2, mp[make_pair(a[i], b[i])], MOD) +
               modpow(2, mp[make_pair(b[i], -a[i])], MOD) - 1;
        used[make_pair(b[i], -a[i])] = true;
      }
      ans %= MOD;
    }
  }
  ans--;
  cout << ans + zero << endl;
}
