#include <bits/stdc++.h>
using namespace std;
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline void dump(T& v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    cout << *i << ((i == --v.end()) ? '\n' : ' ');
  }
}
inline string getline() {
  string s;
  getline(cin, s);
  return s;
}
inline void yn(const bool b) {
  b ? cout << ("yes") << '\n' : cout << ("no") << '\n';
}
inline void Yn(const bool b) {
  b ? cout << ("Yes") << '\n' : cout << ("No") << '\n';
}
inline void YN(const bool b) {
  b ? cout << ("YES") << '\n' : cout << ("NO") << '\n';
}
struct io {
  io() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  }
};
const int INF = INT_MAX;
constexpr long long int LLINF = 1LL << 60;
constexpr long long int MOD = 1000000007;
constexpr double EPS = 1e-9;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int mod_pow(long long int x, long long int n, long long int mod) {
  long long int res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  map<pair<long long int, long long int>, int> m;
  int n;
  cin >> n;
  int zero = 0;
  for (int i = 0; i < (n); ++i) {
    long long int a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    if (a < 0) {
      b *= -1;
      a *= -1;
    }
    int ch = 1;
    if (b < 0) ch = -1;
    long long int t = gcd(a, b * ch);
    a /= t;
    b /= t;
    m[make_pair(a, b)]++;
  }
  long long int ans = 1;
  for (auto i = m.begin(); i != m.end(); i++) {
    pair<int, int> p = make_pair((i->first.second), -(i->first.first));
    if (p.first < 0) {
      p.first *= -1;
      p.second *= -1;
    }
    long long int t = mod_pow(2, i->second, MOD);
    if (m.find(p) != m.end()) {
      t += mod_pow(2, m[p], MOD) - 1;
      t %= MOD;
      m.erase(m.find(p));
    }
    ans *= t;
    ans %= MOD;
  }
  ans += zero;
  ans %= MOD;
  cout << (ans - 1) << '\n';
}
