#include <bits/stdc++.h>
const long double PI = acos(-1);
using namespace std;
inline long long mod(long long n, long long m) {
  long long ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}
long long gcd(long long a, long long b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
void solution() {
  map<pair<long long, long long>, pair<long long, long long> > m;
  long long n;
  cin >> n;
  long long pot2[n + 1];
  pot2[0] = 1;
  for (long long i = 1; i <= n; i++)
    pot2[i] = mod(pot2[i - 1] * 2LL, 1000000007);
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    long long inv_a, inv_b;
    if (a != 0 && b != 0) {
      long long g = abs(gcd(a, b));
      a /= g, b /= g;
      inv_a = abs(b);
      inv_b = abs(a);
      if (a < 0 && b >= 0) {
        inv_a = -inv_a;
      } else if (b < 0 && a >= 0) {
        b = abs(b);
        a = -1LL * abs(a);
        inv_a = -1LL * inv_a;
      }
      if (a < 0 && b < 0) {
        a = abs(a);
        b = abs(b);
      }
      inv_a = -inv_a;
    } else {
      if (a == 0 && b == 0) {
        inv_a = 0;
        inv_b = 0;
      } else if (a == 0) {
        b = 1;
        inv_a = 1;
        inv_b = 0;
      } else if (b == 0) {
        a = 1;
        inv_a = 0;
        inv_b = 1;
      }
    }
    if (m.count(pair<long long, long long>(a, b)))
      m[pair<long long, long long>(a, b)].first++;
    else if (m.count(pair<long long, long long>(inv_a, inv_b)))
      m[pair<long long, long long>(inv_a, inv_b)].second++;
    else
      m[pair<long long, long long>(a, b)] = pair<long long, long long>(1, 0);
  }
  long long ans = 1LL;
  long long more = 0;
  for (auto p : m) {
    if (p.first.first == 0 && p.first.second == 0) {
      more++;
      continue;
    }
    pair<long long, long long> cur = p.second;
    long long group = cur.first;
    long long hate = cur.second;
    ans = mod(ans, 1000000007) + mod(ans * (pot2[group] - 1), 1000000007) +
          mod(ans * (pot2[hate] - 1), 1000000007);
    ans = mod(ans, 1000000007);
  }
  ans = mod(ans + ans * more, 1000000007);
  cout << mod(ans - 1LL, 1000000007) << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solution();
}
