#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1000000007;
const long long int INF = 4611686018427387903;
long long int power(long long int x, long long int y) {
  if (y == 0)
    return 1;
  else if (y == 1)
    return x % MOD;
  else if (y % 2 == 0) {
    long long int pow = power(x, y / 2);
    return (pow * pow) % MOD;
  } else {
    long long int pow = power(x, y / 2);
    return ((pow * pow) % MOD) * x % MOD;
  }
}
long long int ggcd(long long int a, long long int b) {
  if (a < b) swap(a, b);
  long long int r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
int main() {
  int n;
  cin >> n;
  vector<long long int> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  int z = 0;
  map<pair<long long int, long long int>, pair<long long int, long long int> >
      mp;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0 || b[i] == 0) {
      if (a[i] == 0) {
        if (b[i] == 0)
          z++;
        else
          mp[{0, 1}].first++;
      } else
        mp[{0, 1}].second++;
    } else {
      int g = ggcd(abs(a[i]), abs(b[i]));
      if (a[i] * b[i] > 0)
        mp[{abs(a[i] / g), abs(b[i] / g)}].first++;
      else
        mp[{abs(b[i] / g), abs(a[i] / g)}].second++;
    }
  }
  long long int ans = 1;
  for (auto p : mp) {
    ans *= power(2, p.second.first) + power(2, p.second.second) + MOD - 1;
    ans %= MOD;
  }
  ans += z;
  ans += MOD - 1;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
