#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const long long INF = 1ll << 60;
const double pi = acos(-1);
const double eps = 1e-8;
const long long mod = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0}, dy[4] = {0, -1, 0, 1};
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
const int M = 200005;
int n;
long long two[M];
map<pair<long long, long long>, long long> mp;
void f(long long &x, long long &y) {
  if (y < 0 || x < 0 && y == 0) x *= -1, y *= -1;
}
int main() {
  cin >> n;
  two[0] = 1;
  for (int i = 1; i < M; i++) two[i] = two[i - 1] * 2 % mod;
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      mp[{0, 0}]++;
      continue;
    } else if (x == 0)
      y = 1;
    else if (y == 0)
      x = 1;
    else {
      long long g = gcd(abs(x), abs(y));
      x /= g, y /= g;
    }
    f(x, y);
    mp[{x, y}]++;
  }
  long long res = 1, tmp = mp[{0, 0}];
  mp.erase({0, 0});
  set<pair<long long, long long> > st;
  cout << tmp << endl;
  for (auto p : mp) {
    long long x = p.first.first, y = p.first.second, t = p.second;
    long long X = -y, Y = x;
    f(X, Y);
    st.insert({x, y});
    if (st.find({X, Y}) != st.end()) continue;
    if (mp.find({X, Y}) == mp.end())
      (res *= two[t]) %= mod;
    else
      (res *= two[t] + two[mp[{X, Y}]] - 1) %= mod;
  }
  (res += tmp) %= mod;
  cout << (res + mod - 1) % mod << endl;
}
