#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& a) {
  return os << "(" << a.first << "," << a.second << ")";
}
template <class T>
void pv(T a, T b) {
  for (T i = a; i != b; ++i) cout << (*i) << " ";
  cout << endl;
}
template <class T>
void chmin(T& a, const T& b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T& a, const T& b) {
  if (a < b) a = b;
}
int nextInt() {
  int x;
  scanf("%d", &x);
  return x;
}
long long nextLong() {
  long long x;
  scanf("%lld", &x);
  return x;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
pair<long long, long long> normalize(long long A, long long B) {
  if (A == 0 && B == 0) return {0, 0};
  if (A == 0 && B != 0) {
    return {0, 1};
  }
  if (A != 0 && B == 0) {
    return {1, 0};
  }
  long long g = gcd(abs(A), abs(B));
  A /= g;
  B /= g;
  if (B < 0) {
    A *= -1;
    B *= -1;
  }
  return {A, B};
}
const long long MOD = 1000000007;
const int MAX_N = 212345;
long long two[MAX_N];
int main2() {
  int N = nextInt();
  map<pair<long long, long long>, long long> count;
  for (int i = 0, _n = (int)(N); i < _n; ++i) {
    long long A = nextInt();
    long long B = nextInt();
    auto v = normalize(A, B);
    ++count[v];
  }
  long long ans = 1;
  for (auto item : count) {
    auto v1 = item.first;
    auto v2 = normalize(-v1.second, v1.first);
    if (count[v2] == 0) {
      ans *= two[item.second];
      ans %= MOD;
    } else if (v1 < v2) {
      ans *= (1 + two[count[v1]] - 1 + two[count[v2]] - 1 + MOD) % MOD;
      ans %= MOD;
    }
  }
  if (count[{0, 0}] > 0) {
    ans += count[{0, 0}];
    ans %= MOD;
  }
  ans = (ans - 1 + MOD) % MOD;
  cout << ans << endl;
  return 0;
}
int main() {
  two[0] = 1;
  for (int i = 0, _n = (int)(MAX_N - 1); i < _n; ++i)
    two[i + 1] = (two[i] * 2) % MOD;
  main2();
  return 0;
}
