#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return (!b) ? a : gcd(b, a % b); }
int main() {
  ios_base::sync_with_stdio(false);
  long long po[200005] = {1};
  for (int i = 1; i < 200005; i++) po[i] = po[i - 1] * 2 % 100000007;
  long long ans = -1, n;
  cin >> n;
  map<pair<long long, long long>, pair<int, int> > cnt;
  while (n--) {
    long long x, y;
    cin >> x >> y;
    if (!x && !y) {
      ans++;
      continue;
    }
    if (pair<long long, long long>(x, y) < pair<long long, long long>(0, 0)) {
      x *= -1;
      y *= -1;
    }
    long long g = gcd(abs(x), abs(y));
    x /= g;
    y /= g;
    if (y > 0)
      cnt[{x, y}].first++;
    else
      cnt[{-y, x}].second++;
  }
  long long res = 1;
  for (auto p : cnt)
    res = res * (po[p.second.first] + po[p.second.second] - 1) % 100000007;
  cout << (ans + res + 100000007) % 100000007;
  return 0;
}
