#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 200200;
long long p2[N];
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  p2[0] = 1;
  for (int i = 1; i < N; i++) {
    p2[i] = (p2[i - 1] * 2) % mod;
  }
  int n;
  cin >> n;
  map<pair<long long, long long>, pair<int, int>> m;
  int zeros = 0;
  for (int i = 0; i < n; i++) {
    long long int a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      zeros++;
    else {
      long long int g = gcd(abs(a), abs(b));
      a /= g;
      b /= g;
      int r = 0;
      while (a >= 0 and b > 0) {
        swap(a, b);
        a = -a;
        r++;
      }
      if (r % 2)
        m[{a, b}].first++;
      else
        m[{a, b}].second++;
    }
  }
  long long int ans = 1;
  for (auto e : m) {
    pair<int, int> cnt = e.second;
    ans = (1LL * ans * (p2[cnt.first] + p2[cnt.second] - 1)) % mod;
  }
  ans = (ans + 1LL * zeros - 1LL) % mod;
  cout << ans << endl;
  return 0;
}
