#include <bits/stdc++.h>
using namespace std;
long long INF = 1e18;
long long mod = 1e9 + 7;
long long gcd(long long x, long long y) {
  while (x > 0) {
    if (x < y) swap(x, y);
    x %= y;
  }
  return y;
}
map<pair<long long, long long>, pair<long long, long long>> M;
long long z = 0;
long long x_zero = 0, y_zero = 0;
long long second[200010];
int main() {
  long long n;
  cin >> n;
  second[0] = 1;
  for (int i = 1; i <= n; i++) {
    second[i] = second[i - 1] * 2;
    second[i] %= mod;
  }
  for (int i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    if (x == 0 && y == 0)
      x++;
    else if (x == 0) {
      x_zero++;
    } else if (y == 0) {
      y_zero++;
    } else {
      if (y < 0) {
        y = -y;
        x = -x;
      }
      long long g = gcd(abs(x), abs(y));
      x /= g;
      y /= g;
      if (x < 0)
        M[{y, -x}].first++;
      else
        M[{x, y}].second++;
    }
  }
  long long ret = 1;
  for (auto m : M) {
    long long a = second[m.second.first] + second[m.second.second] - 1;
    ret = (ret * a) % mod;
  }
  long long single_one = second[x_zero] + second[y_zero] - 1;
  ret = (ret * single_one) % mod;
  ret += z;
  ret %= mod;
  ret += mod - 1;
  ret %= mod;
  cout << ret << endl;
  return 0;
}
