#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
map<pair<long long, long long>, pair<int, int> > mm;
long long fp(long long p) {
  if (p == 0) return 1;
  long long res = fp(p / 2);
  res = (res * res) % MOD;
  if (p % 2) res = (res * 2) % MOD;
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  long long a, b, g;
  cin >> n;
  long long res = 1;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a != 0 || b != 0) {
      if (a == 0)
        mm[pair<long long, long long>(0, 1)].first++;
      else if (b == 0)
        mm[pair<long long, long long>(0, 1)].second++;
      else {
        g = gcd(abs(a), abs(b));
        a /= g;
        b /= g;
        if ((a > 0) != (b > 0)) {
          mm[pair<long long, long long>(abs(b), abs(a))].second++;
        } else
          mm[pair<long long, long long>(abs(a), abs(b))].first++;
      }
    } else
      mm[pair<long long, long long>(0, 0)].first++;
  }
  if (mm.size() == 1 && mm.count(pair<long long, long long>(0, 0)) > 0) {
    cout << mm[pair<long long, long long>(0, 0)].first << endl;
    return 0;
  }
  pair<int, int> ac;
  long long fac;
  for (map<pair<long long, long long>, pair<int, int> >::iterator it =
           mm.begin();
       it != mm.end(); it++) {
    ac = it->second;
    fac = (fp(ac.first) + fp(ac.second) - 1) % MOD;
    if (fac < 0) fac += MOD;
    res = (res * fac) % MOD;
  }
  res = res + mm[pair<long long, long long>(0, 0)].first - 1;
  if (res < 0) res += MOD;
  cout << res << endl;
  return 0;
}
