#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long MOD = 1e+9 + 7;
struct mint {
  long long x;
  mint(long long x = 0) : x(x % MOD) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
mint pow2[200010];
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];
  pow2[0].x = 1;
  for (int i = 0; i < 200000; ++i) {
    pow2[i + 1] = pow2[i] * (mint)2;
  }
  using pll = pair<long long, long long>;
  map<pll, long long> mp;
  mint cnt0;
  for (int i = 0; i < n; ++i) {
    long long g = gcd(abs(a[i]), abs(b[i]));
    long long aa = abs(a[i]) / g, bb = abs(b[i]) / g;
    if ((a[i] < 0 && b[i] > 0) || (a[i] > 0 && b[i] < 0)) {
      mp[{-aa, bb}]++;
    } else if (a[i] == 0 && b[i] == 0) {
      cnt0 += (mint)1;
    } else {
      mp[{aa, bb}]++;
    }
  }
  mint res(1);
  for (auto m : mp) {
    mint tmp;
    long long aa = m.first.first, bb = m.first.second;
    long long val = m.second;
    if (aa > 0) {
      tmp = pow2[val] + pow2[mp[{-bb, aa}]] - (mint)1;
      mp[{aa, bb}] = 0;
      mp[{-bb, aa}] = 0;
    } else if (aa == 0) {
      tmp = pow2[val] + pow2[mp[{bb, aa}]] - (mint)1;
      mp[{aa, bb}] = 0;
      mp[{bb, aa}] = 0;
    } else {
      tmp = pow2[val] + pow2[mp[{bb, -aa}]] - (mint)1;
      mp[{aa, bb}] = 0;
      mp[{bb, -aa}] = 0;
    }
    res *= tmp;
  }
  res += cnt0 - (mint)1;
  cout << res.x << "\n";
  return 0;
}
