#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
inline long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long lowbit(long long x) { return (x & -x); }
inline long long kissme(long long x, long long y) {
  long long res = 1;
  if (x == 0) return 1;
  if (x == 1) return y;
  res = kissme(x / 2, y);
  res = res * res % mod;
  if (x % 2 == 1) res = res * y % mod;
  return res;
}
int n;
long long ans = 1, a, b, cnt, res;
map<pair<long long, long long>, int> mp;
vector<int> v;
map<pair<long long, long long>, bool> vis;
signed main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a < 0 && b < 0) a = -a, b = -b;
    if (a != 0 && b != 0) {
      long long g = gcd(abs(a), abs(b));
      a /= g;
      b /= g;
    } else {
      if (a == 0 && b == 0) {
        res++, res %= mod;
        continue;
      } else if (a == 0)
        b = 1;
      else
        a = 1;
    }
    if (b < 0) a = -a, b = -b;
    mp[make_pair(a, b)]++;
  }
  for (map<pair<long long, long long>, int>::iterator it = mp.begin();
       it != mp.end(); it++) {
    pair<long long, long long> p = it->first;
    long long sum, num = it->second;
    if (vis[p]) continue;
    if (p.first < 0) p.first = -p.first, p.second = -p.second;
    sum = kissme(num, 2) + kissme(mp[make_pair(-p.second, p.first)], 2);
    vis[make_pair(-p.second, p.first)] = true;
    sum--;
    sum %= mod;
    if (it->first.first == -p.second && it->first.second == p.first) sum = 2;
    ans = ans * sum % mod;
  }
  cout << (ans - 1 + mod + res) % mod << "\n";
  return 0;
}
