#include <bits/stdc++.h>
using namespace std;
struct pr {
  long long pl, mn;
  pr() { pl = mn = 0; }
};
unordered_map<long double, pr> mp;
long double getPr(const long double& ld) {
  if (ld == 1000000000000000001) {
    return 0;
  }
  if (ld == 0) {
    return 1000000000000000001;
  }
  return -1.0 / ld;
}
long long fastPow(long long a, long long pow) {
  if (pow == 0) return 1;
  if (pow == 1) return a;
  long long nxt = fastPow(a, pow / 2);
  if (pow & 1) {
    return (((nxt * nxt) % 1000000007) * a) % 1000000007;
  } else {
    return (nxt * nxt) % 1000000007;
  }
}
long long getAns(unordered_map<long double, pr>::iterator it) {
  if (it == mp.end()) {
    return 1;
  }
  pr cur = it->second;
  it++;
  long long nxtAns = getAns(it);
  return (((fastPow(2, cur.pl) + fastPow(2, cur.mn) - 1) % 1000000007) *
          nxtAns) %
         1000000007;
}
signed main() {
  long long n, zer = 0;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    long double id;
    if (a == 0 && b == 0) {
      zer++;
      continue;
    } else if (b == 0) {
      id = 1000000000000000001;
    } else {
      id = (long double)a / b;
    }
    if (id <= 0) {
      id = getPr(id);
      mp[id].mn++;
    } else {
      mp[id].pl++;
    }
  }
  cout << (getAns(mp.begin()) - 1 + 1000000007 + zer) % 1000000007 << endl;
  return 0;
}
