#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)(1e9 + 7);
const long long INF = (long long)(1e13 + 7);
long long CEIL(long long a, long long b) {
  return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b);
}
long long mod(long long a, long long b) {
  return a >= 0 ? a % b : a - (b * CEIL(a, b));
}
long long bpm(long long x, unsigned long long y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  long long ans = 1;
  long long digit = (long long)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (long long i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (long long i = 0; i < container.size() - 1; i++)
    container[i + 1] += container[i];
}
template <class T>
struct reduction {
 private:
  long long gcd(long long a, long long b) { return (b ? gcd(b, a % b) : a); }
  long long lcm(long long a, long long b) { return a * b / gcd(a, b); }

 public:
  T first;
  T second;
  reduction(long long a, long long b) : first(a), second(b) {
    if (a == 0 and b == 0) {
      first = second = 0;
    } else if (a == 0) {
      first = 0, second = 1;
    } else if (b == 0) {
      first = -1, second = 0;
    } else {
      long long GCD = gcd(abs(first), abs(second));
      first /= GCD;
      second /= GCD;
    }
  }
};
class EBullet {
 public:
  static void solve(std::istream &cin, std::ostream &cout) {
    long long N;
    cin >> N;
    map<pair<long long, long long>, long long> counter;
    for (long long i = 0; i < (long long)(N); i++) {
      long long A, B;
      cin >> A >> B;
      reduction<long long> rd(A, B);
      if (A * B < 0)
        counter[{-abs(rd.first), -abs(rd.second)}]++;
      else
        counter[{rd.first, rd.second}]++;
    }
    long long ans = 1;
    for (auto &i : counter) {
      if (i.first.first == 0 and i.first.second == 0) {
        continue;
      } else {
        if (counter.count({-i.first.second, -i.first.first})) {
          ans *= (bpm(2, i.second) +
                  bpm(2, counter[{-i.first.second, -i.first.first}]) - 1);
          counter[{-i.first.second, -i.first.first}] = 0;
          i.second = 0;
        } else {
          ans *= bpm(2, i.second);
        }
      }
      ans %= MOD;
    }
    ans += counter[{0, 0}];
    if (ans == 0)
      ans = MOD - 1;
    else
      ans -= 1;
    cout << ans << endl;
  }
};
signed main() {
  EBullet solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}
