#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << H << " ";
  debug_out(T...);
}
constexpr inline long long MOD = 1000000007;
int n;
map<pair<long long, long long>, int> dir;
long long ans = 1;
long long gcd(long long a, long long b) {
  a = abs(a);
  b = abs(b);
  while (b > 0) {
    long long tmp = a;
    a = b;
    b = tmp % b;
  }
  return a;
}
long long pw(long long b, int a) {
  long long res = 1;
  while (a > 0) {
    if (a & 1) {
      res = res * b % MOD;
      a--;
    } else {
      b = b * b % MOD;
      a /= 2;
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  for (int i = 0; i < (int)(n); i++) {
    long long a, b;
    cin >> a >> b;
    long long g = gcd(a, b);
    a = a / g;
    b = b / g;
    if (!((a >= 0 && b >= 0) || (a < 0 && b > 0))) {
      a = -a;
      b = -b;
    }
    dir[pair<long long, long long>(a, b)]++;
  }
  for (auto tup : dir) {
    long long a = tup.first.first;
    long long b = tup.first.second;
    int cnt = tup.second;
    long long c = (a >= 0) ? (-b) : b;
    long long d = abs(a);
    if ((a == 0 && b == 0) ||
        (a <= 0 && (dir.count(pair<long long, long long>(c, d)) > 0))) {
      continue;
    }
    auto it = dir.find(pair<long long, long long>(c, d));
    int cnt2 = (it == dir.end()) ? 0 : it->second;
    ans = ans * (pw(2, cnt) + pw(2, cnt2) - 1) % MOD;
  }
  ans = (ans + dir[pair<long long, long long>(0, 0)] - 1) % MOD;
  cout << ans << endl;
  return 0;
}
