#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
ostream& operator<<(ostream& out, const pair<A, B>& a) {
  return out << "(" << a.first << ", " << a.second << ")";
}
template <class A>
ostream& operator<<(ostream& out, const vector<A>& v) {
  out << "[";
  for (long long i = 0; i < long long(long long(v.size())); i++) {
    if (i) out << ", ";
    out << v[i];
  }
  return out << "]";
}
long long Mod(long long x) {
  const long long mm = 1000000007;
  x %= mm;
  if (x < 0) x += mm;
  return x;
}
long long Pow(long long x, long long n) {
  if (n == 0) return 1;
  long long t = Pow(x, n / 2);
  t = Mod(t * t);
  if (n & 1) t = Mod(t * x);
  return t;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
pair<long long, long long> comp(pair<long long, long long> x) {
  long long a = x.first, b = x.second;
  long long s = (a / abs(a)) * (b / abs(b));
  long long g = gcd(abs(a), abs(b));
  a = abs(a);
  b = abs(b);
  a /= g, b /= g;
  pair<long long, long long> t;
  t.first = -s * b;
  t.second = a;
  return t;
}
long long main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long mod = 1000000007;
  map<pair<long long, long long>, long long> mp;
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 and b == 0) {
      mp[{0, 0}]++;
      continue;
    }
    if (a == 0) {
      mp[{0, 1}]++;
      continue;
    }
    if (b == 0) {
      mp[{1, 0}]++;
      continue;
    }
    long long s = (a / abs(a)) * (b / abs(b));
    long long g = gcd(abs(a), abs(b));
    a = abs(a);
    b = abs(b);
    a /= g, b /= g;
    mp[{s * a, b}]++;
  }
  long long ans = 1;
  map<pair<long long, long long>, long long> vis;
  for (auto y : mp) {
    pair<long long, long long> x = y.first;
    if (x.first == 0 or x.second == 0) continue;
    if (vis[x] or vis[comp(x)]) continue;
    pair<long long, long long> cmp = comp(x);
    vis[x]++;
    vis[cmp]++;
    long long t = Pow(2, mp[x]);
    t += Pow(2, mp[cmp]);
    t %= mod;
    t = Mod(t - 1);
    ans = Mod(ans * t);
  }
  long long t = Pow(2, mp[{1, 0}]);
  t += Pow(2, mp[{0, 1}]);
  t %= mod;
  t = Mod(t - 1);
  ans = Mod(ans * t);
  cout << (ans - 1) + mp[{0, 0}] << endl;
}
