#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long INF = 1e18;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long p(long long n) {
  long long ans = 1;
  int i;
  (i, a, b) for (i = a; i < b; i++)(i, 0, n) ans = (ans * 2) % inf;
  return ans;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  long long n, i, x, y, c = 0, a = 0, b = 0;
  cin >> n;
  vector<pair<long long, long long> > V;
  multiset<pair<long long, long long> > M;
  (i, a, b) for (i = a; i < b; i++)(i, 0, n) {
    cin >> x >> y;
    if (x == y && x == 0) {
      c++;
      continue;
    }
    if (x == 0) {
      a++;
      continue;
    }
    if (y == 0) {
      b++;
      continue;
    }
    if (y < 0) {
      x *= -1;
      y *= -1;
    }
    long long g = gcd(abs(x), abs(y));
    x /= g;
    y /= g;
    V.push_back(make_pair(x, y));
    M.insert(make_pair(x, y));
  }
  sort(V.begin(), V.end());
  long long ans = 1;
  ans = (p(a) * p(b)) % inf;
  i = 0;
  while (i < V.size()) {
    while (i < V.size() - 1 && V[i] == V[i + 1]) i++;
    x = V[i].first;
    y = V[i].second;
    int k = M.count(make_pair(-y, x)) + M.count(make_pair(y, -x));
    if (k == 0 || x > 0) ans = (ans * (p(k) + p(M.count(V[i])) - 1)) % inf;
    i++;
  }
  cout << (ans + c - 1 + inf) % inf << endl;
  return 0;
}
