#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  if (b == 0) return a;
  if (a == 0)
    return b;
  else
    return gcd(b, a % b);
}
long long modpow(long long n) {
  long long res = 1;
  long long a = 2;
  long long mod = 1e9 + 7;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  const long long mod = 1e9 + 7;
  long long n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (long long i = 0; i < (n); i++) cin >> a[i] >> b[i];
  map<pair<long long, long long>, long long> mp;
  for (long long i = 0; i < (n); i++) {
    long long c = gcd(a[i], b[i]);
    if (a[i] < 0) {
      a[i] *= -1;
      b[i] *= -1;
    }
    if (c != 0) {
      a[i] /= c;
      b[i] /= c;
    } else {
      a[i] /= abs(a[i]);
      b[i] /= abs(b[i]);
    }
    mp[{a[i], b[i]}]++;
  }
  long long res = 1;
  for (long long i = 0; i < (n); i++) {
    if (mp[{a[i], b[i]}] == 0) continue;
    if (a[i] == 0 && b[i] == 0) {
      res *= mp[{a[i], b[i]}] + 1;
      mp[{a[i], b[i]}] = 0;
    } else if (mp[{b[i], -a[i]}] == 0 && mp[{-b[i], a[i]}] == 0) {
      res *= modpow(mp[{a[i], b[i]}]);
      mp[{a[i], b[i]}] = 0;
    } else {
      res *= modpow(mp[{a[i], b[i]}]) +
             modpow(mp[{b[i], -a[i]}] + mp[{-b[i], a[i]}]) - 1;
      mp[{a[i], b[i]}] = 0;
      mp[{b[i], -a[i]}] = 0;
      mp[{-b[i], a[i]}] = 0;
    }
    res %= mod;
  }
  cout << res - 1 << endl;
  return 0;
}
