#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int>> v;
int n;
long long int a, b;
const long long int MOD = 1e9 + 7;
map<pair<long long int, long long int>, int> cnt;
vector<pair<long long int, long long int>> arr;
long long int gcd(long long int a, long long int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long int mypow(long long int n) {
  long long int res = 1;
  long long int x = 2;
  while (n > 0) {
    if (n % 2 == 1) {
      res = ((res % MOD) * (x % MOD) % MOD);
      res %= MOD;
    }
    x = ((x % MOD) * (x % MOD) % MOD);
    x %= MOD;
    n /= 2;
  }
  return res;
}
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    v.push_back(make_pair(a, b));
  }
  long long int countzero = 0;
  for (int i = 0; i < n; i++) {
    if (v[i].first == 0 && v[i].second == 0) {
      countzero++;
    } else if (v[i].first == 0) {
      if (cnt.find(make_pair(0, 1)) == cnt.end()) {
        cnt[make_pair(0, 1)] = 0;
        cnt[make_pair(1, 0)] = 0;
        arr.push_back(make_pair(1, 0));
      }
      cnt[make_pair(0, 1)]++;
    } else if (v[i].second == 0) {
      if (cnt.find(make_pair(0, 1)) == cnt.end()) {
        cnt[make_pair(0, 1)] = 0;
        cnt[make_pair(1, 0)] = 0;
        arr.push_back(make_pair(1, 0));
      }
      cnt[make_pair(1, 0)]++;
    } else {
      long long int g = gcd(abs(v[i].first), abs(v[i].second));
      v[i].first /= g;
      v[i].second /= g;
      if (v[i].first < 0 && v[i].second < 0 ||
          v[i].first > 0 && v[i].second < 0) {
        v[i].first *= -1;
        v[i].second *= -1;
      }
      if (v[i].first < 0) {
        if (cnt.find(make_pair(v[i].first, v[i].second)) == cnt.end()) {
          cnt[make_pair(v[i].first, v[i].second)] = 0;
          cnt[make_pair(abs(v[i].second), abs(v[i].first))] = 0;
          arr.push_back(make_pair(abs(v[i].second), abs(v[i].first)));
        }
        cnt[make_pair(v[i].first, v[i].second)]++;
      } else {
        if (cnt.find(make_pair(abs(v[i].first), abs(v[i].second))) ==
            cnt.end()) {
          cnt[make_pair(abs(v[i].first), abs(v[i].second))] = 0;
          cnt[make_pair(-1 * abs(v[i].second), abs(v[i].first))] = 0;
          arr.push_back(make_pair(abs(v[i].first), abs(v[i].second)));
        }
        cnt[make_pair(v[i].first, v[i].second)]++;
      }
    }
  }
  cout << arr.size() << '\n';
  long long int res = 1;
  for (int i = 0; i < arr.size(); i++) {
    auto x = arr[i].first;
    auto y = arr[i].second;
    long long int num =
        mypow(cnt[make_pair(x, y)]) + mypow(cnt[make_pair(-y, x)]) - 1;
    num %= MOD;
    if (num < 0) {
      num += MOD;
    }
    res = (res % MOD) * (num % MOD);
    res %= MOD;
  }
  res -= 1;
  if (res < 0) {
    res += MOD;
  }
  res = (res % MOD) + (countzero % MOD);
  res %= MOD;
  cout << res << '\n';
  return 0;
}
