#include <bits/stdc++.h>
using namespace std;

// #define int ll
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using si = set<int>;
using ii = pair<int, int>;
using vii = vector<ii>;

#define rep(i, n) for (int i = 0; i < n; i++)
#define dotc()    int tcs; if (cin >> tcs) rep(tc, tcs)
#define sz(x)     (int)x.size()
#define eb        emplace_back
#define pb        push_back
#define mp        make_pair
#define all(x)    x.begin(), x.end()
#define rall(x)   x.rbegin(), x.rend()
#define fi        first
#define se        second

ll mod(1000000007);
double pi(acos(-1.0));

ll modexp2(int e) {
  ll r = 1, b = 2;
  while (e) {
    if (e & 1) r = r * b % mod;
    b = b * b % mod;
    e /= 2;
  }
  return r;
}

int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL
  freopen("io\\in.txt", "r", stdin);
  freopen("io\\out.txt", "w", stdout);
#endif

  int n;
  cin >> n;

  map<pair<ll, ll>, pair<ll, ll>> m;
  int cnt00 = 0;
  rep(i, n) {
    ll a, b;
    cin >> a >> b;
    if (a == b && !a) cnt00++;
    else if (!a) {
      m[{0, 0}].fi++;
    } else if (!b) {
      m[{0, 0}].se++;
    } else {
      if (b < 0) a *= -1, b *= -1;
      ll g = __gcd(a, b);
      ll x = a / g, y = b / g;

      if (x > 0) m[{x, y}].fi++;
      else m[{y, -x}].se++;
    }
  }

  ll cnt = 1;
  for (auto& i : m) {
    cnt = (cnt * (modexp2(i.se.fi) + modexp2(i.se.se) - 1)) % mod;
  }

  cout << (cnt + cnt00 + mod - 1) % mod;

  return 0;
}
