#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  if (a < b) swap(a, b);
  return a % b == 0 ? b : gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
const int mod = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<pair<long long, long long>> d;
  int zero = 0;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      zero++;
    else
      d.emplace_back(a, b);
  }
  map<pair<long long, long long>, pair<int, int>> mp;
  for (int i = 0; i < d.size(); i++) {
    long long g = gcd(d[i].first, d[i].second);
    pair<long long, long long> p = make_pair(d[i].first / g, d[i].second / g);
    if (p.second < 0) {
      p.first = -p.first;
      p.second = -p.second;
    }
    if (p.second == 0 && p.first < 0) {
      p.first = -p.first;
      p.second = -p.second;
    }
    bool rot = false;
    if (p.first <= 0) {
      long long tmp = p.second;
      p.second = -p.first;
      p.first = tmp;
      rot = true;
    }
    if (rot)
      mp[p].second++;
    else
      mp[p].first++;
  }
  mint ans = 1;
  for (auto p : mp) {
    int s = p.second.first;
    int t = p.second.second;
    mint u = 1;
    u += mint(2).pow(s) - 1;
    u += mint(2).pow(t) - 1;
    ans *= u;
  }
  ans -= 1;
  ans += zero;
  cout << ans << "\n";
}
