#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000 * 1000 * 1000 + 7;
long long GCD(long long a, long long b) {
  if (a < 0) a *= -1;
  if (b < 0) b *= -1;
  if (a == 0) return b;
  return GCD(b % a, a);
}
void Normalize(long long& x, long long& y) {
  long long g = GCD(x, y);
  x /= g;
  y /= g;
  if (make_pair(x, y) < make_pair(-x, -y)) {
    x = -x;
    y = -y;
  }
}
long long Pow(long long x, int n) {
  long long result = 1;
  for (int i = 0; i < n; ++i) result = result * 2 % mod;
  return result;
}
int main() {
  int n;
  cin >> n;
  vector<long long> x, y;
  long long add = 0;
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      add++;
      continue;
    }
    x.push_back(a);
    y.push_back(b);
  }
  n = x.size();
  map<pair<long long, long long>, long long> m;
  for (int i = 0; i < n; ++i) {
    long long cx = x[i];
    long long cy = y[i];
    Normalize(cx, cy);
    m[{cx, cy}]++;
  }
  long long result = 1;
  for (int i = 0; i < n; ++i) {
    long long cx = x[i];
    long long cy = y[i];
    Normalize(cx, cy);
    if (m[{cx, cy}] == 0) continue;
    long long nx = cy;
    long long ny = -cx;
    Normalize(nx, ny);
    long long p1 = Pow(2, m[{cx, cy}]);
    long long p2 = Pow(2, m[{nx, ny}]);
    result = result * (p1 + p2 + mod - 1) % mod;
    m[{cx, cy}] = 0;
    m[{nx, ny}] = 0;
  }
  result = max<long long>(0, result - 1);
  result = (result + mod + add) % mod;
  cout << result << endl;
  return 0;
}
