#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
  ll n;
  cin >> n;
  vector<pair<ll,ll>> vec;
  vector<ll> ch(n,0);
  ll sum1 = 0;
  ll sum2 = 0;
  ll sum3 = 0;
  vector<ll> arr(n+1);
  ll p = 1;
  arr[0] = 1;
  rep(i,n){
    arr[i+1] = arr[i] * 2;
    arr[i+1] %= mod;
  }
  ll ans = 0;
  map<pair<ll,ll>, ll> mp;
  ll cou = 0;
  pair<ll,ll> pa1,pa2;
  rep(i,n){
    cin >> t1 >> t2;
    if(t1 < 0){
      t1 *= -1;
      t2 *= -1;
    }

    if(t1 != 0 && t2 != 0){
      t3 = gcd(t1,t2);
      t1 /= t3;
      t2 /= t3;
    }
    cout << t1 << " " << t2 << endl;
    if(t1 == 0 && t2 == 0){
      continue;
    }
    if(t1 == 0){
      ch[i] += 2;
    }
    if(t2 == 0){
      ch[i] += 1;
    }
    pa1 = make_pair(t1,t2);
    pa2 = make_pair(-t2,t1);
    if(ch[i] == 0){
      vec.emplace_back(pa1);
      sum1++;
    }else if(ch[i] == 1){
      sum2++;
    }else if(ch[i] == 2){
      sum3++;
    }
    mp[pa1]++;
    ans += arr[cou - mp[pa2]];
    cou++;
  }
  cout << ans << endl;
}