#include <bits/stdc++.h>
using namespace std;
unsigned long long min(unsigned long long x, unsigned long long y) {
  if (x < y) return x;
  return y;
}
unsigned long long max(unsigned long long x, unsigned long long y) {
  if (x < y) return y;
  return x;
}
long long min(long long x, long long y) {
  if (x < y) return x;
  return y;
}
long long max(long long x, long long y) {
  if (x < y) return y;
  return x;
}
double min(double x, double y) {
  if (x < y) return x;
  return y;
}
double max(double x, double y) {
  if (x < y) return y;
  return x;
}
unsigned long long gcd(unsigned long long x, unsigned long long y) {
  if (!x) return y;
  if (!y) return x;
  if (x > y) swap(x, y);
  return gcd(x, y % x);
}
unsigned long long inv(unsigned long long a, unsigned long long c) {
  if (a == 1) {
    return 1;
  }
  return ((c - (c / a)) * inv(c % a, c)) % c;
}
long long n, a, b, p2[200005] = {0}, M = 1000000007, ans = 1;
map<pair<long long, long long>, int> mp, vis;
long long mul(long long a, long long b) { return (a * b) % M; }
long long add(long long a, long long b) {
  a += b;
  if (a >= M) a -= M;
  if (a < 0) a += M;
  return a;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  p2[0] = 1;
  for (int i = 1; i <= n; i++) {
    p2[i] = mul(p2[i - 1], (long long)2);
  }
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    long long g = gcd(a, b);
    if (g) {
      a /= g;
      b /= g;
    }
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    if ((a == 0) && (b != 0)) {
      b = 1;
    } else if ((a != 0) && (b == 0)) {
      a = 1;
    }
    mp[make_pair(a, b)]++;
  }
  for (map<pair<long long, long long>, int>::iterator it = mp.begin();
       it != mp.end(); ++it) {
    if ((!vis[it->first]) &&
        (it->first != make_pair((long long)0, (long long)0))) {
      long long a = (it->first).first, b = (it->first).second;
      long long aa = -b, bb = a;
      long long g = gcd(aa, bb);
      if (g) {
        aa /= g;
        bb /= g;
      }
      if (aa < 0) {
        aa *= -1;
        bb *= -1;
      }
      if ((aa == 0) && (bb != 0)) {
        b = 1;
      } else if ((aa != 0) && (bb == 0)) {
        a = 1;
      }
      pair<long long, long long> p = make_pair(aa, bb);
      int n1 = it->second, n2 = (mp.find(p) == mp.end()) ? 0 : mp[p];
      ans = mul(ans, add(p2[n1], add(p2[n2], (long long)-1)));
      vis[it->first]++;
      vis[p]++;
    }
  }
  ans = add(ans, (long long)-1);
  ans = add(ans, mp[make_pair((long long)0, (long long)0)]);
  cout << ans << "\n";
  return 0;
}
