#include <bits/stdc++.h>
using namespace std;
const int Z = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  map<pair<long long, long long>, int> cnt;
  int cnt0 = 0;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      cnt0++;
    } else {
      if (b < 0) {
        a *= -1;
        b *= -1;
      }
      long long d = gcd(abs(a), abs(b));
      a /= d;
      b /= d;
      cnt[{a, b}]++;
    }
  }
  int pow2[n + 1];
  for (int i = 0; i <= n; i++) {
    pow2[i] = i == 0 ? 1 : 2 * pow2[i - 1] % Z;
  }
  int ans = 1;
  for (auto p : cnt) {
    int a = p.first.first, b = p.first.second;
    if (a <= 0 && cnt.count({b, -a})) {
      continue;
    }
    int p1 = p.second;
    int p2 = cnt.count({-b, a}) ? cnt[{-b, a}] : 0;
    ans = 1ll * ans * (pow2[p1] + pow2[p2] - 1) % Z;
  }
  ans = (0ll + ans + cnt0 + Z - 1) % Z;
  cout << ans << endl;
  return 0;
}
