#include <bits/stdc++.h>
using namespace std;
long GCD(long a, long b) {
  if (b == 0l) return a;
  if (a < b)
    return GCD(b, a);
  else
    return GCD(b, a % b);
}
long modpow(long a, long n, long mod) {
  long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  int N;
  cin >> N;
  vector<pair<long, long> > A(N);
  for (int i = 0; (i) < (N); (i)++) {
    long a, b;
    cin >> a >> b;
    if (a == 0l && b == 0l) {
      A[i].first = a;
      A[i].first = b;
    } else if (a == 0l && b != 0l) {
      A[i].first = 0l;
      A[i].first = 1l;
    } else if (a != 0l && b == 0l) {
      A[i].first = 1l;
      A[i].first = 0l;
    } else {
      long g = GCD(abs(a), abs(b));
      a = a / g;
      b = b / g;
      if (a >= 0l) {
        A[i].first = a;
        A[i].second = b;
      } else {
        A[i].first = -a;
        A[i].second = -b;
      }
    }
  }
  sort(A.begin(), A.end());
  bool check[200005];
  int para[200005], perp[200005];
  int zero;
  int ind = 0;
  for (int i = 0; (i) < (N); (i)++) para[i] = 0, perp[i] = 0;
  for (int i = 0; (i) < (N); (i)++) check[i] = false;
  if (A[0].first == 0l && A[0].second == 0l) {
    int end = (int)(upper_bound(A.begin(), A.end(), A[0]) - A.begin());
    for (int j = 0; j < end; j++) check[j] = true;
    zero = end;
  }
  for (int i = 0; (i) < (N); (i)++) {
    if (!check[i]) {
      int end = (int)(upper_bound(A.begin(), A.end(), A[i]) - A.begin());
      for (int j = i; j < end; j++) check[j] = true;
      para[ind] = end - i;
      pair<long, long> p;
      p.first = abs(A[i].second);
      if (A[i].second >= 0l)
        p.second = -abs(A[i].first);
      else
        p.second = abs(A[i].first);
      int start = (int)(lower_bound(A.begin(), A.end(), p) - A.begin());
      end = (int)(upper_bound(A.begin(), A.end(), p) - A.begin());
      for (int j = start; j < end; j++) check[j] = true;
      perp[ind] = end - start;
      ind++;
    }
  }
  long mod = 1000000007;
  long ans = 1l;
  for (int i = 0; (i) < (ind); (i)++) {
    long temp = modpow(2l, (long)para[i], mod);
    temp += modpow(2l, (long)perp[i], mod);
    temp %= mod;
    temp--;
    if (temp < 0l) temp += mod;
    ans *= temp;
    ans %= mod;
  }
  ans--;
  if (ans < 0l) ans += mod;
  ans += zero;
  ans %= mod;
  cout << ans << endl;
  return 0;
}
