#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
struct mint {
  long long val;
  mint(long long x = 0) : val((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-val); }
  mint& operator+=(const mint a) {
    if ((val += a.val) >= mod) val -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((val += mod - a.val) >= mod) val -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (val *= a.val) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(long long n) const {
    if (!n) return 1;
    mint a = pow(n >> 1);
    a *= a;
    if (n & 1) a *= *this;
    return a;
  }
  mint mod_pow(long long x, long long n) {
    if (n == 0) return 1;
    mint res = mod_pow(x * x % 1000000007, n / 2);
    if (n & 1) res = res.val * x % 1000000007;
    return res;
  }
  mint choose(long long n, long long a) {
    mint x = 1, y = 1;
    for (int i = 0; i < (int)(a); i++) {
      x *= n - i;
      y *= i + 1;
    }
    return x / y;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
vector<pair<long long, long long> > p;
long long gcd(long long a, long long b) {
  return a % b == 0 ? b : gcd(b, a % b);
}
int main(void) {
  int n;
  cin >> n;
  int zero = 0;
  map<pair<long long, long long>, pair<long long, long long> > mp;
  for (int i = 0; i < (int)(n); i++) {
    long long x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      zero++;
      continue;
    }
    long long g = gcd(x, y);
    x /= g;
    y /= g;
    if (y < 0) {
      x = -x;
      y = -y;
    }
    if (y == 0 && x < 0) {
      x = -x;
      y = -y;
    }
    bool rot = (x <= 0);
    if (rot) {
      long long tmp = x;
      x = y;
      y = -tmp;
    }
    if (rot)
      mp[{x, y}].first++;
    else
      mp[{x, y}].second++;
  }
  mint ans = 1;
  for (auto p : mp) {
    long long s = p.second.first;
    long long t = p.second.second;
    mint now = 1;
    now += mint(2).pow(s) - 1;
    now += mint(2).pow(t) - 1;
    ans *= now;
  }
  ans -= 1;
  ans += zero;
  cout << ans.val << endl;
  return 0;
}
