#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-9;
const long long INF = 10e17;
double equal(double a, double b) { return fabs(a - b) < DBL_EPSILON; }
std::istream &operator>>(std::istream &in, set<int> &o) {
  int a;
  in >> a;
  o.insert(a);
  return in;
}
std::istream &operator>>(std::istream &in, queue<int> &o) {
  long long a;
  in >> a;
  o.push(a);
  return in;
}
bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }
const int mod = 1000000007;
struct mint {
  long long x;
  mint(long long x = 0) : x((x % mod + mod) % 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;
  }
  friend std::istream &operator>>(std::istream &in, mint &o) {
    long long a;
    in >> a;
    o = a;
    return in;
  }
  friend std::ostream &operator<<(std::ostream &out, const mint &o) {
    out << o.x;
    return out;
  }
};
long long gcd(long long x, long long y) {
  x = abs(x);
  y = abs(y);
  if (x > y) swap(x, y);
  long long m = 1;
  while (m != 0) {
    m = y % x;
    y = x;
    x = m;
  }
  return y;
}
mint cou(vector<pair<long long, long long>> ps) {
  map<pair<long long, long long>, int> m;
  for (pair<long long, long long> p : ps) m[p]++;
  vector<int> c;
  for (auto &e : m) c.push_back(e.second);
  if (c.size() == 1) {
    return mint(2).pow(c.front());
  } else {
    assert(c.size() == 2);
    return mint(2).pow(c.front()) + mint(2).pow(c.back()) - 1;
  }
}
mint couzz(vector<pair<long long, long long>> ps) {
  int ans = 0;
  for (pair<long long, long long> p : ps) {
    if (p == pair<long long, long long>(0, 0)) ans++;
  }
  return ans;
}
mint couzo(vector<pair<long long, long long>> ps) {
  vector<pair<long long, long long>> tmp;
  for (pair<long long, long long> p : ps) {
    if (p == pair<long long, long long>(0, 0)) continue;
    if (p.first == 0 || p.second == 0) tmp.push_back(p);
  }
  if (tmp.empty()) return 1;
  return cou(tmp);
}
vector<pair<long long, long long>> filter_zero(
    vector<pair<long long, long long>> ps) {
  vector<pair<long long, long long>> tmp;
  for (pair<long long, long long> p : ps) {
    if (p.first == 0 || p.second == 0) continue;
    tmp.push_back(p);
  }
  return tmp;
}
int main() {
  int n;
  cin >> n;
  vector<pair<long long, long long>> sardines(n);
  for (int i = 0; i < (n); ++i) cin >> sardines[i].first >> sardines[i].second;
  mint zz = couzz(sardines);
  mint zo = couzo(sardines);
  sardines = filter_zero(sardines);
  n = sardines.size();
  for (int i = 0; i < (n); ++i) {
    long long g = gcd(sardines[i].first, sardines[i].second);
    sardines[i].first /= g;
    sardines[i].second /= g;
    if (sardines[i].first < 0 && sardines[i].second < 0) {
      sardines[i].first = -sardines[i].first;
      sardines[i].second = -sardines[i].second;
    } else if (sardines[i].first > 0 && sardines[i].second < 0) {
      sardines[i].first = -sardines[i].first;
      sardines[i].second = -sardines[i].second;
    }
  }
  for (pair<long long, long long> p : sardines)
    assert(p.first > 0 && p.second > 0 || p.first < 0 && p.second > 0);
  map<pair<long long, long long>, vector<pair<long long, long long>>> m;
  auto norm = [](pair<long long, long long> p) {
    if (p.first >= 0 && p.second >= 0)
      return p;
    else {
      pair<long long, long long> q(p.second, -p.first);
      assert(p.first * q.first + p.second * q.second == 0);
      return q;
    }
  };
  for (pair<long long, long long> p : sardines) {
    pair<long long, long long> r = norm(p);
    if (m.find(p) != m.end())
      m[p].push_back(p);
    else if (m.find(r) != m.end())
      m[r].push_back(p);
    else
      m[r].push_back(p);
  }
  mint ans = zo;
  for (auto &e : m) {
    mint now = cou(e.second);
    ans *= now;
  }
  ans = ans + zz;
  ans = ans - 1;
  cout << ans << endl;
}
