#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265359;
const int MAXN = 100005;
long long mod = 1000000007;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  map<pair<long long, long long>, pair<long long, long long>> slope;
  int n;
  long long pw[2 * MAXN] = {1};
  pw[0] = 1;
  for (int i = 1; i <= 2 * MAXN - 1; i++) pw[i] = (pw[i - 1] * 2) % mod;
  cin >> n;
  long long z = 0;
  for (int i = 0; i < (n); i++) {
    long long x, y;
    cin >> x >> y;
    if (x == 0 and y == 0) {
      z++;
      continue;
    }
    if (make_pair(x, y) < make_pair(0ll, 0ll)) x = -x, y = -y;
    long long g = gcd(abs(x), abs(y));
    x /= g, y /= g;
    if (y <= 0)
      slope[{-y, x}].second++;
    else
      slope[{x, y}].first++;
  }
  long long r = 1;
  for (auto& p : slope) {
    r = (r * (pw[p.second.first] + pw[p.second.second] - 1) % mod) % mod;
  }
  r--;
  cout << (r + z) % mod << "\n";
  return 0;
}
