#include <bits/stdc++.h>
using namespace std;
void __print(int first) { cerr << first; }
void __print(long first) { cerr << first; }
void __print(long long first) { cerr << first; }
void __print(unsigned first) { cerr << first; }
void __print(unsigned long first) { cerr << first; }
void __print(unsigned long long first) { cerr << first; }
void __print(float first) { cerr << first; }
void __print(double first) { cerr << first; }
void __print(long double first) { cerr << first; }
void __print(char first) { cerr << '\'' << first << '\''; }
void __print(const char *first) { cerr << '\"' << first << '\"'; }
void __print(const string &first) { cerr << '\"' << first << '\"'; }
void __print(bool first) { cerr << (first ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &first) {
  cerr << '{';
  __print(first.first);
  cerr << ',';
  __print(first.second);
  cerr << '}';
}
template <typename T>
void __print(const T &first) {
  int f = 0;
  cerr << '{';
  for (auto &i : first) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
long long power(long long first, long long second) {
  long long temp, f;
  if (second == 0) return 1;
  temp = power(first, second / 2) % 1000000007;
  if (second % 2 == 0)
    return (temp * temp) % 1000000007;
  else {
    f = (first * temp) % 1000000007;
    f = (f * temp) % 1000000007;
    return f;
  }
}
long long gcdExtended(long long a, long long b, long long *first,
                      long long *second) {
  if (a == 0) {
    *first = 0, *second = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = gcdExtended(b % a, a, &x1, &y1);
  *first = y1 - (b / a) * x1;
  *second = x1;
  return gcd;
}
long long modInverse(long long a, long long m) {
  long long first, second;
  long long g = gcdExtended(a, m, &first, &second);
  if (g != 1)
    assert(0);
  else {
    long long res = (first % m + m) % m;
    return res;
  }
}
map<long long, long long> hash1, hash2;
long long MOD1 = 1000000007, MOD2 = 1000000009;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n, zero_cnt = 0;
  cin >> n;
  pair<long long, long long> a[n + 1];
  long long no[n + 1], num = 0, den = 0;
  for (long long i = 1; i < n + 1; i++) {
    cin >> a[i].first >> a[i].second;
    long long a1 = (a[i].first > 0 ? 1 : -1), b1 = (a[i].second > 0 ? 1 : -1);
    if (a[i].first == 0 && a[i].second == 0) continue;
    if (a[i].second != 0 && a[i].first != 0) {
      no[i] = (abs(a[i].first) * modInverse(abs(a[i].second), 1000000007)) %
              1000000007;
      ;
      if (a1 * b1 > 0)
        hash1[no[i]]++;
      else
        hash2[no[i]]++;
    } else {
      if (a[i].second == 0)
        den++;
      else
        num++;
    }
  }
  long long ans = 1;
  for (auto &node : hash1) {
    long long inv = modInverse(node.first, 1000000007);
    ;
    ans =
        (ans *
         (power(2, hash1[node.first]) + power(2, hash2[inv]) + 1000000007 - 1) %
         1000000007) %
        1000000007;
  };
  for (auto &node : hash2) {
    long long inv = modInverse(node.first, 1000000007);
    if (hash1.find(inv) == hash1.end()) {
      ;
      ans = (ans * (power(2, hash2[node.first])) % 1000000007) % 1000000007;
    }
  };
  ans = (ans * (power(2, den) + power(2, num) + 1000000007 - 1)) % 1000000007;
  ans = (ans + 1000000007 - 1) % 1000000007;
  cout << ans << "\n";
}
