#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
constexpr int MOD = 1000000007;
int mod(const ll &x) { return x > 0 ? x % MOD : (x + MOD) % MOD; }
int modm(const ll &x, const ll &m) { return (x % MOD) * (m % MOD) % MOD; }
int modpow(ll x, ll p) {
  int ret = 1;
  while (p > 0) {
    if (p & 1) ret = modm(ret, x);
    x = modm(x, x);
    p >>= 1;
  }
  return ret;
}
int modd(ll x, ll d) { return modm(x, modpow(d, MOD - 2)); }
ll gcd(ll a, ll b) {
  if (a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}
template <class Iit>
void vout(const Iit &begin, const Iit &end, ostream &out) {
  for (auto it = begin; it != end; it++) {
    auto tmp = it;
    if (++tmp == end)
      out << it->first << ":" << it->second << '\n';
    else
      out << it->first << ":" << it->second << " ";
  }
}
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  map<pll, int> mp;
  for (int i = (0); i < (N); i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0) {
      mp[{0, 0}]++;
    } else if (b == 0) {
      mp[{0, 1}]++;
    } else {
      if (b > 0)
        mp[{a / gcd(a, b), b / gcd(a, b)}]++;
      else
        mp[{-a / gcd(a, b), -b / gcd(a, b)}]++;
    }
  }
  map<set<pll>, int> mp2;
  mp2[set<pll>()] = 1;
  for (auto p : mp) {
    map<set<pll>, int> tmp;
    for (auto p2 : mp2) {
      if (p2.first.find({-p.first.second, p.first.first}) == p2.first.end()) {
        set<pll> s2 = p2.first;
        s2.insert(p.first);
        tmp[s2] = modm(p2.second, mod(modpow(2, p.second) - 1));
      }
    }
    for (auto p2 : tmp) mp2[p2.first] = p2.second;
  }
  int ans = 0;
  for (auto p : mp2) ans = mod(ans + p.second);
  ans = mod(ans - 1);
  cout << ans << '\n';
  return 0;
}
