#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mem(a) memset(a,0,sizeof a)
const int N=1e5+5;
const int INF=1e9+5;
ll read(ll &a){scanf("%lld",&a);return a;}
int read(int &a){scanf("%d",&a);return a;}
int read(){int a;scanf("%d",&a);return a;}
int read(int &a,int &b){scanf("%d %d",&a,&b);return a;}
int n;
struct edge
{
    int a;
    int b1,b2;
    edge(int a=0,int b1=0,int b2=0):a(a),b1(b1),b2(b2){}
    bool operator <(const edge b)const
    {
        if(a!=b.a)
            return a<b.a;

        if(b1!=b.b1)
            return b1<b.b1;

        if(b2!=b.b2)
            return b2<b.b2;
    }
};
vector<edge>r;
vector<edge>c;

int tree[N<<1];
int M;
void modify(int n,ll v)
{
    for(tree[n+=M]+=v,n>>=1;n;n>>=1)
        tree[n]=tree[n*2]+tree[n*2+1];
}
ll query(int l,int r)
{
    ll ans=0;
    for(l+=M-1,r+=M+1;l^r^1;l>>=1,r>>=1)
    {
        if(~l&1) ans+=tree[l^1];
        if(r&1)ans+=tree[r^1];
    }
    return ans;
}

int mi(int n)
{
    int cnt=0;
    while((1<<cnt)<n)
        cnt++;
    return cnt;
}
int X1,X2,Y1,Y2;
int main()
{
    M=1<<mi(5005);
    cin>>n;

    while(n--)
    {
        cin>>X1>>Y1>>X2>>Y2;

        if(X1>X2)
            swap(X1,X2);
        if(Y1>Y2)
            swap(Y1,Y2);
        if(X1==X2)
            c.push_back(edge(X1,Y1,Y2));
        else
            r.push_back(edge(Y1,X1,X2));
    }
    ll ans=0;
    //cout<<r.size()<<' '<<c.size()<<endl;
    if(r.size()<c.size())
    {
        //cout<<"r"<<endl;
        swap(r,c);
    }

    sort(r.begin(),r.end());

    sort(c.begin(),c.end());
    //cout<<c.size()<<endl;
    //cout<<c[0].a<<' '<<c[0].b1<<endl;
    for(int i=0;i<c.size();i++)
    {
        mem(tree);
        priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > >pq;

        for(edge &h:r)
        {
            if(h.b1<=c[i].a)
            {
                //cout<<h.b1<<endl;
                modify(h.a,1);
                pq.emplace(h.b2,h.a);
                //cout<<pq.top().first<<endl;
            }
        }
        for(int j=i+1;j<c.size();j++)
        {
            while(!pq.empty()&&pq.top().first<c[j].a)
            {
                modify(pq.top().second,-1);
                pq.pop();
            }
            int low=max(c[i].b1,c[j].b1);
            int high=min(c[i].b2,c[j].b2);
            //cout<<low<<' '<<high<<endl;
            if(low<high)
            {
                int cnt=query(low,high);
                //cout<<cnt<<endl;
                ans+=cnt*(cnt-1)/2;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}
/*
100
0 0 1
0 1 1
1 0 1
*/


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mem(a) memset(a,0,sizeof a)
const int N=1e5+5;
const int INF=1e9+5;
ll read(ll &a){scanf("%lld",&a);return a;}
int read(int &a){scanf("%d",&a);return a;}
int read(){int a;scanf("%d",&a);return a;}
int read(int &a,int &b){scanf("%d %d",&a,&b);return a;}
int n;
struct edge
{
    int a;
    int b1,b2;
    edge(int a=0,int b1=0,int b2=0):a(a),b1(b1),b2(b2){}
    bool operator <(const edge b)const
    {

            return a<b.a;

    }
};
vector<edge>r;
vector<edge>c;

int tree[N<<2];
int M;
void modify(int n,ll v)
{
    for(tree[n+=M]+=v,n>>=1;n;n>>=1)
        tree[n]=tree[n*2]+tree[n*2+1];
}
ll query(int l,int r)
{
    ll ans=0;
    for(l+=M-1,r+=M+1;l^r^1;l>>=1,r>>=1)
    {
        if(~l&1) ans+=tree[l^1];
        if(r&1)ans+=tree[r^1];
    }
    return ans;
}

int X1,X2,Y1,Y2;
int main()
{

    for(M=1;M<10000;M<<=1);
    //cout<<M<<endl;
    cin>>n;

    while(n--)
    {
        cin>>X1>>Y1>>X2>>Y2;
        if(X1>X2)
            swap(X1,X2);
        if(Y1>Y2)
            swap(Y1,Y2);
        if(X1==X2)
            c.push_back(edge(X1,Y1,Y2));
        else
            r.push_back(edge(Y1,X1,X2));
    }
    ll ans=0;
    //cout<<r.size()<<' '<<c.size()<<endl;
    if(r.size()<c.size())
    {
        //cout<<"r"<<endl;
        swap(r,c);
    }

    sort(r.begin(),r.end());

    sort(c.begin(),c.end());
    //cout<<c.size()<<endl;
    //cout<<c[0].a<<' '<<c[0].b1<<endl;
    for(int i=0;i<c.size();i++)
    {
        mem(tree);
        priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > >pq;

        for(edge &h:r)
        {
            if(h.b1<=c[i].a)
            {
                //cout<<h.b1<<endl;
                modify(h.a,1);
                pq.emplace(h.b2,h.a);
                //cout<<pq.top().first<<endl;
            }
        }
        for(int j=i+1;j<c.size();j++)
        {
            while(!pq.empty()&&pq.top().first<c[j].a)
            {
                modify(pq.top().second,-1);
                pq.pop();
            }
            int low=max(c[i].b1,c[j].b1);
            int high=min(c[i].b2,c[j].b2);
            //cout<<low<<' '<<high<<endl;
            if(low<=high)
            {
                int cnt=query(low,high);
                //cout<<cnt<<endl;
                ans+=cnt*(cnt-1)/2;
            }
        }
    }
    cout<<ans<<endl;

    return 0;
}
/*
100
0 0 1
0 1 1
1 0 1
*/


#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

#define add push_back
#define rem pop_back
#define F first
#define S second

#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define DEBUG(x) cout << #x << " " << x << endl;

#define forn(i, a, b) for(int i = a; i <= b; i++)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))

template<typename T1, typename T2> auto max ( T1 a, T2 b ) { auto max = a > b ? a : b; return max; }
template<typename T1, typename T2> auto min ( T1 a, T2 b ) { auto min = a < b ? a : b; return min; }

template<typename T1, typename T2> void updmax ( T1 &a, T2 b ) { a = a > b ? a : b; }
template<typename T1, typename T2> void updmin ( T1 &a, T2 b ) { a = a < b ? a : b; }

int px[] = { 1, -1, 0, 0 };
int py[] = { 0, 0, -1, 1 };
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };

const double EPS = 1e-9;
const double PI = acos ( -1. );
const int mod = ( int ) 1e9 + 7;
long long inf = __INT64_MAX__;

static const int MAXN = ( int ) 5e5 + 10;
static int a[MAXN], b[MAXN];

int n, m, k;
int res, ans, cnt;
string s, t;

struct ver{

	int p, x1, x2;

};
struct gor{

	int p, y1, y2;

};

vector<ver> v1;
vector<gor> v2;

void solution()
{
	cin >> n;
	for( int i = 0; i < n; i++ ){

		int x1, y1, x2, y2;
		scanf( "%d %d %d %d", &x1, &y1, &x2, &y2 );
		if( x1 == x2 )
			v2.add( gor{ x1, y1, y2 } );
		else{
			int p = y1;
			int x11 = min( x1, x2 );
			int x22 = max( x1, x2 );
			v1.add( ver{ p, x11, x22 } );
		}

	}

	sort( v2.begin(), v2.end(), []( gor a, gor b ){
		return a.p < b.p;
	});
	sort( v1.begin(), v1.end(), []( ver a, ver b ){
		return a.x2 > b.x2;
	});

	for( int i = 0; i < v2.size(); i++ ){
		int l = 0;
		tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> tr;
		for( int j = v2.size() - 1; j > i; j-- ){
			int y1 = min( v2[i].y1, v2[i].y2 );
			int y2 = max( v2[i].y1, v2[i].y2 );
			int y3 = min( v2[j].y1, v2[j].y2 );
			int y4 = max( v2[j].y1, v2[j].y2 );
			if( y2 < y3 || y4 < y1 || v2[i].p == v2[j].p ) continue;
			while( l < v1.size() && v1[l].x2 >= v2[j].p ){
				if( v1[l].x1 <= v2[i].p ) tr.insert( v1[l].p );
				l++;
			}
			int L = max( y1, y3 );
			int R = min( y2, y4 );
			cnt = tr.order_of_key( R + 1 ) - tr.order_of_key( L );
			ans += cnt * ( cnt - 1 ) / 2;
		}
	}
	cout << ans << endl;
}

int32_t main ( )
{

        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        //cout.precision(15);

        int query = 1;
        // cin >> query;

        while ( query-- ) solution();

        return 0;

}


#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

#define add push_back
#define rem pop_back
#define F first
#define S second

#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define DEBUG(x) cout << #x << " " << x << endl;

#define forn(i, a, b) for(int i = a; i <= b; i++)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))

template<typename T1, typename T2> auto max ( T1 a, T2 b ) { auto max = a > b ? a : b; return max; }
template<typename T1, typename T2> auto min ( T1 a, T2 b ) { auto min = a < b ? a : b; return min; }

template<typename T1, typename T2> void updmax ( T1 &a, T2 b ) { a = a > b ? a : b; }
template<typename T1, typename T2> void updmin ( T1 &a, T2 b ) { a = a < b ? a : b; }

int px[] = { 1, -1, 0, 0 };
int py[] = { 0, 0, -1, 1 };
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };

const double EPS = 1e-9;
const double PI = acos ( -1. );
const int mod = ( int ) 1e9 + 7;
long long inf = __INT64_MAX__;

static const int MAXN = ( int ) 5e5 + 10;
static int a[MAXN], b[MAXN];

int n, m, k;
int res, cnt;
string s, t;
long long ans;

struct ver{

	int p, x1, x2;

};
struct gor{

	int p, y1, y2;

};

vector<ver> v1;
vector<gor> v2;

void solution()
{
	cin >> n;
	for( int i = 0; i < n; i++ ){

		int x1, y1, x2, y2;
		scanf( "%d%d%d%d", &x1, &y1, &x2, &y2 );
		if( x1 == x2 )
			v2.add( gor{ x1, y1, y2 } );
		else{
			int p = y1;
			int x11 = min( x1, x2 );
			int x22 = max( x1, x2 );
			v1.add( ver{ p, x11, x22 } );
		}

	}

	sort( v2.begin(), v2.end(), []( gor a, gor b ){
		return a.p < b.p;
	});
	sort( v1.begin(), v1.end(), []( ver a, ver b ){
		return a.x2 > b.x2;
	});

	for( int i = 0; i < v2.size(); i++ ){
		int l = 0;
		tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> tr;
		for( int j = v2.size() - 1; j > i; j-- ){
			int y1 = min( v2[i].y1, v2[i].y2 );
			int y2 = max( v2[i].y1, v2[i].y2 );
			int y3 = min( v2[j].y1, v2[j].y2 );
			int y4 = max( v2[j].y1, v2[j].y2 );
			if( y2 < y3 || y4 < y1 || v2[i].p == v2[j].p ) continue;
			while( l < v1.size() && v1[l].x2 >= v2[j].p ){
				if( v1[l].x1 <= v2[i].p ) tr.insert( v1[l].p );
				l++;
			}
			int L = max( y1, y3 );
			int R = min( y2, y4 );
			long long cnt = tr.order_of_key( R + 1 ) - tr.order_of_key( L );
			ans += cnt * ( cnt - 1 ) / 2;
		}
	}
	cout << ans << endl;
}

int32_t main ( )
{

        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        //cout.precision(15);

        int query = 1;
        // cin >> query;

        while ( query-- ) solution();

        return 0;

}


#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

#define int long long
#define add push_back
#define rem pop_back
#define F first
#define S second

#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define DEBUG(x) cout << #x << " " << x << endl;

#define forn(i, a, b) for(int i = a; i <= b; i++)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*((b)/gcd(a,b)))

template<typename T1, typename T2> auto max ( T1 a, T2 b ) { auto max = a > b ? a : b; return max; }
template<typename T1, typename T2> auto min ( T1 a, T2 b ) { auto min = a < b ? a : b; return min; }

template<typename T1, typename T2> void updmax ( T1 &a, T2 b ) { a = a > b ? a : b; }
template<typename T1, typename T2> void updmin ( T1 &a, T2 b ) { a = a < b ? a : b; }

int px[] = { 1, -1, 0, 0 };
int py[] = { 0, 0, -1, 1 };
int dx[] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[] = { 0, 1, 0, -1, 1, -1, 1, -1 };

const double EPS = 1e-9;
const double PI = acos ( -1. );
const int mod = ( int ) 1e9 + 7;
long long inf = __INT64_MAX__;

static const int MAXN = ( int ) 5e5 + 10;
static int a[MAXN], b[MAXN];

int n, m, k;
int res, ans, cnt;
string s, t;

struct ver{

	int p, x1, x2;

};
struct gor{

	int p, y1, y2;

};

vector<ver> v1;
vector<gor> v2;

void solution()
{
	cin >> n;
	for( int i = 0; i < n; i++ ){

		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		if( x1 == x2 )
			v2.add( gor{ x1, y1, y2 } );
		else{
			int p = y1;
			int x11 = min( x1, x2 );
			int x22 = max( x1, x2 );
			v1.add( ver{ p, x11, x22 } );
		}

	}

	sort( v2.begin(), v2.end(), []( gor a, gor b ){
		return a.p < b.p;
	});
	sort( v1.begin(), v1.end(), []( ver a, ver b ){
		return a.x2 > b.x2;
	});

	for( int i = 0; i < v2.size(); i++ ){
		int l = 0;
		tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> tr;
		for( int j = v2.size() - 1; j > i; j-- ){
			int y1 = min( v2[i].y1, v2[i].y2 );
			int y2 = max( v2[i].y1, v2[i].y2 );
			int y3 = min( v2[j].y1, v2[j].y2 );
			int y4 = max( v2[j].y1, v2[j].y2 );
			if( y2 < y3 || y4 < y1 || v2[i].p == v2[j].p ) continue;
			while( l < v1.size() && v1[l].x2 >= v2[j].p ){
				if( v1[l].x1 <= v2[i].p ) tr.insert( v1[l].p );
				l++;
			}
			int L = max( y1, y3 );
			int R = min( y2, y4 );
			cnt = tr.order_of_key( R + 1 ) - tr.order_of_key( L );
			ans += cnt * ( cnt - 1 ) / 2;
		}
	}
	cout << ans << endl;
}

int32_t main ( )
{

        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        ios_base::sync_with_stdio ( false ); cin.tie ( nullptr ); cout.tie ( nullptr );
        //cout.precision(15);

        int query = 1;
        // cin >> query;

        while ( query-- ) solution();

        return 0;

}


/**
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
**/

#include <bits/stdc++.h>

using namespace std;

typedef pair <long long ,long long>	PII;
typedef priority_queue<PII,vector<PII>,greater<PII>> pairMinHeap;
typedef priority_queue<PII> pairMaxHeap;
typedef priority_queue<long long ,vector<long long>,greater<long long>> minHeap;
typedef priority_queue<long long> maxHeap;

#define what_is(x) cerr <<#x<<" is "<<x<<endl;
#define wis(x,y) cerr <<#x<<" is "<<x<<" and "<<#y<<" is "<<y<<endl;

const long long MD=24;
inline long long mul(long long a, long long b){
    return (a*b)%MD;
}

inline long long po(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1)ans = mul(ans,a);
        a = mul(a,a);
        b/=2;
    }
    return ans;
}

long long INF=1e17;
const int N=1e4+22;

long long n,m,t,k;
long long arr[N];
long long x;
//string s[N];

vector<pair<int , pair<int,int>>> v,h;

int tree[2][N][N];

void update(int x, int y, int val, int w){
    int y1;
    while (x <= N){
        y1 = y;
        while (y1 <= N){
            tree[w][x][y1] += val;
            y1 += (y1 & -y1);
        }
        x += (x & -x);
    }
}

long long get(int x, int y, int w) {
    int y1;
    long long ans = 0;
    while (x > 0){
        y1 = y;
        while (y1 > 0){
            ans += tree[w][x][y1];
            y1 -= (y1 & -y1);
        }
        x -= (x & -x);
    }
    return ans;
}

int main(){
    ios::sync_with_stdio(false);

    cin >> n;

    for (int i = 0; i < n; i++) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        x1 += 5001;
        x2 += 5001;
        y1 += 5001;
        y2 += 5001;
        if (x1 == x2) {
            v.push_back({x1, {min(y1, y2), max(y1, y2)}});
        } else {
            //h.push_back({y1, {min(x1, x2), max(x1,x2)}});
            update(min(x1, x2), y1, 1, 0);
            update(max(x1, x2), y1, 1, 1);
        }
    }
    sort(h.begin(), h.end());
    long long ans = 0;
    for (int i = 0; i < v.size(); i++) {
        for (int j = i + 1; j < v.size(); j++) {
            int w = 0;
            int y1 = max(v[i].second.first, v[j].second.first);
            int y2 = min(v[i].second.second, v[j].second.second);
            int x1 = min(v[i].first, v[j].first);
            int x2 = max(v[i].first, v[j].first);

            for (auto z : h) {
                if (z.first >= y1 && z.first <= y2 && z.second.first <= x1 && z.second.second >= x2) w++;
            }

            long long st = get(x1, y2, 0) - get(x1, y1-1, 0);
            long long en = get(x2-1, y2, 1) - get(x2-1, y1-1, 1);

            w = st - en;

            if (w >= 2) ans += (w * (w-1)) / 2;

        }
    }

    cout << ans;

    return 0;
}


/**
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
**/

#include <bits/stdc++.h>

using namespace std;

typedef pair <long long ,long long>	PII;
typedef priority_queue<PII,vector<PII>,greater<PII>> pairMinHeap;
typedef priority_queue<PII> pairMaxHeap;
typedef priority_queue<long long ,vector<long long>,greater<long long>> minHeap;
typedef priority_queue<long long> maxHeap;

#define what_is(x) cerr <<#x<<" is "<<x<<endl;
#define wis(x,y) cerr <<#x<<" is "<<x<<" and "<<#y<<" is "<<y<<endl;

const long long MD=24;
inline long long mul(long long a, long long b){
    return (a*b)%MD;
}

inline long long po(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1)ans = mul(ans,a);
        a = mul(a,a);
        b/=2;
    }
    return ans;
}

long long INF=1e17;
const int N=1e5+33;

long long n,m,t,k;
long long arr[N];
long long x;
//string s[N];

vector<pair<int , pair<int,int>>> v,h;

int main(){
    ios::sync_with_stdio(false);

    cin >> n;

    for (int i = 0; i < n; i++) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        if (x1 == x2) {
            v.push_back({x1, {min(y1, y2), max(y1, y2)}});
        } else {
            h.push_back({y1, {min(x1, x2), max(x1,x2)}});
        }
    }
    sort(h.begin(), h.end());
    long long ans = 0;
    for (int i = 0; i < v.size(); i++) {
        for (int j = i + 1; j < v.size(); j++) {
            int w = 0;
            int y1 = max(v[i].second.first, v[j].second.first);
            int y2 = min(v[i].second.second, v[j].second.second);
            int x1 = min(v[i].first, v[j].first);
            int x2 = max(v[i].first, v[j].first);

            for (auto z : h) {
                if (z.first >= y1 && z.first <= y2 && z.second.first <= x1 && z.second.second >= x2) w++;
            }

            if (w >= 2) ans += (w * (w-1)) / 2;

        }
    }

    cout << ans;

    return 0;
}


/**
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
**/

#include <bits/stdc++.h>

using namespace std;

typedef pair <long long ,long long>	PII;
typedef priority_queue<PII,vector<PII>,greater<PII>> pairMinHeap;
typedef priority_queue<PII> pairMaxHeap;
typedef priority_queue<long long ,vector<long long>,greater<long long>> minHeap;
typedef priority_queue<long long> maxHeap;

#define what_is(x) cerr <<#x<<" is "<<x<<endl;
#define wis(x,y) cerr <<#x<<" is "<<x<<" and "<<#y<<" is "<<y<<endl;

const long long MD=24;
inline long long mul(long long a, long long b){
    return (a*b)%MD;
}

inline long long po(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1)ans = mul(ans,a);
        a = mul(a,a);
        b/=2;
    }
    return ans;
}

long long INF=1e17;
const int N=1e4+22;

long long n,m,t,k;
long long arr[N];
long long x;
//string s[N];

vector<pair<int , pair<int,int>>> v,h;

short tree[2][N][N];

void update(int x, int y, int val, int w){
    int y1;
    while (x <= N){
        y1 = y;
        while (y1 <= N){
            tree[w][x][y1] += val;
            y1 += (y1 & -y1);
        }
        x += (x & -x);
    }
}

long long get(int x, int y, int w) {
    int y1;
    long long ans = 0;
    while (x > 0){
        y1 = y;
        while (y1 > 0){
            ans += tree[w][x][y1];
            y1 -= (y1 & -y1);
        }
        x -= (x & -x);
    }
    return ans;
}

int main(){
    ios::sync_with_stdio(false);

    cin >> n;

    for (int i = 0; i < n; i++) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        x1 += 5001;
        x2 += 5001;
        y1 += 5001;
        y2 += 5001;
        if (x1 == x2) {
            v.push_back({x1, {min(y1, y2), max(y1, y2)}});
        } else {
            //h.push_back({y1, {min(x1, x2), max(x1,x2)}});
            update(min(x1, x2), y1, 1, 0);
            update(max(x1, x2), y1, 1, 1);
        }
    }
    sort(h.begin(), h.end());
    long long ans = 0;
    for (int i = 0; i < v.size(); i++) {
        for (int j = i + 1; j < v.size(); j++) {
            int w = 0;
            int y1 = max(v[i].second.first, v[j].second.first);
            int y2 = min(v[i].second.second, v[j].second.second);
            int x1 = min(v[i].first, v[j].first);
            int x2 = max(v[i].first, v[j].first);

            for (auto z : h) {
                if (z.first >= y1 && z.first <= y2 && z.second.first <= x1 && z.second.second >= x2) w++;
            }

            long long st = get(N-1, y2, 1) - get(N-1, y1-1, 1) - (get(x2-1, y2, 1) - get(x2-1, y1-1, 1));
            long long en = get(N-1, y2, 0) - get(N-1, y1-1, 0) - (get(x1-1, y2, 0) - get(x1-1, y1-1, 0));

            w = st - en;

            if (w >= 2) ans += (w * (w-1)) / 2;

        }
    }

    cout << ans;

    return 0;
}


/**
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
**/

#include <bits/stdc++.h>

using namespace std;

typedef pair <long long ,long long>	PII;
typedef priority_queue<PII,vector<PII>,greater<PII>> pairMinHeap;
typedef priority_queue<PII> pairMaxHeap;
typedef priority_queue<long long ,vector<long long>,greater<long long>> minHeap;
typedef priority_queue<long long> maxHeap;

#define what_is(x) cerr <<#x<<" is "<<x<<endl;
#define wis(x,y) cerr <<#x<<" is "<<x<<" and "<<#y<<" is "<<y<<endl;

const long long MD=24;
inline long long mul(long long a, long long b){
    return (a*b)%MD;
}

inline long long po(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1)ans = mul(ans,a);
        a = mul(a,a);
        b/=2;
    }
    return ans;
}

long long INF=1e17;
const int N=1e5+22;

long long n,m,t,k;
long long arr[N];
long long x;
long long shift = 5100;
//string s[N];

vector<pair<int , pair<int,int>>> v,h;

int tree[N+10];

void update(int x, int val) {
    while (x <= N){
        tree[x] += val;
        x += (x & -x);
    }
}

long long get(int x) {
    long long ans = 0;
    while (x > 0){
        ans += tree[x];
        x -= (x & -x);
    }
    return ans;
}

int main(){
    ios::sync_with_stdio(false);

    cin >> n;

    for (int i = 0; i < n; i++) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        x1 += shift;
        x2 += shift;
        y1 += shift;
        y2 += shift;
        if (x1 == x2) {
            v.push_back({x1, {min(y1, y2), max(y1, y2)}});
        } else {
            h.push_back({y1, {min(x1, x2), max(x1,x2)}});
        }
    }
    sort(v.begin(), v.end());
    long long ans = 0;
    for (int i = 0; i < (int)v.size(); i++) {
        pairMinHeap hp;
        for (auto x : h) {
            if (x.first <= v[i].second.second && x.first >= v[i].second.first && x.second.first <= v[i].first) {
                hp.push({x.second.second, x.first});
                update(x.first, 1);
            }
        }
        for (int j = i+1; j < (int)v.size() && !hp.empty(); j++) {
            while (!hp.empty() && hp.top().first < v[j].first) {
                update(hp.top().second, -1);
                hp.pop();
            }
            long long t = get(v[j].second.second) - get(v[j].second.first - 1);
            //cerr << v[i].first << " " << v[j].first << " : " << t << endl;
            ans += (t * (t-1)) / 2;
        }
        while (!hp.empty()) {
            update(hp.top().second, -1);
            hp.pop();
        }
    }
    cout << ans;

    return 0;
}


/**
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
**/

#include <bits/stdc++.h>

using namespace std;

typedef pair <long long ,long long>	PII;
typedef priority_queue<PII,vector<PII>,greater<PII>> pairMinHeap;
typedef priority_queue<PII> pairMaxHeap;
typedef priority_queue<long long ,vector<long long>,greater<long long>> minHeap;
typedef priority_queue<long long> maxHeap;

#define what_is(x) cerr <<#x<<" is "<<x<<endl;
#define wis(x,y) cerr <<#x<<" is "<<x<<" and "<<#y<<" is "<<y<<endl;

const long long MD=24;
inline long long mul(long long a, long long b){
    return (a*b)%MD;
}

inline long long po(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1)ans = mul(ans,a);
        a = mul(a,a);
        b/=2;
    }
    return ans;
}

long long INF=1e17;
const int N=1e4+22;

long long n,m,t,k;
long long arr[N];
long long x;
long long shift = 5001;
//string s[N];

vector<pair<int , pair<int,int>>> v,h;

int tree[10500];

void update(int x, int val) {
    while (x <= N){
        tree[x] += val;
        x += (x & -x);
    }
}

long long get(int x) {
    long long ans = 0;
    while (x > 0){
        ans += tree[x];
        x -= (x & -x);
    }
    return ans;
}

int main(){
    ios::sync_with_stdio(false);

    cin >> n;

    for (int i = 0; i < n; i++) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        x1 += shift;
        x2 += shift;
        y1 += shift;
        y2 += shift;
        if (x1 == x2) {
            v.push_back({x1, {min(y1, y2), max(y1, y2)}});
        } else {
            h.push_back({y1, {min(x1, x2), max(x1,x2)}});
        }
    }
    sort(v.begin(), v.end());
    long long ans = 0;
    for (int i = 0; i < (int)v.size(); i++) {
        pairMaxHeap hp;
        for (auto x : h) {
            if (x.first <= v[i].second.second && x.first >= v[i].second.first && x.second.first <= v[i].first) {
                hp.push({x.second.second, x.first});
                update(x.first, 1);
            }
        }
        for (int j = i+1; j < (int)v.size() && !hp.empty(); j++) {
            while (!hp.empty() && hp.top().first < v[j].first) {
                update(hp.top().second, -1);
                hp.pop();
            }
            long long t = get(v[j].second.second) - get(v[j].second.first - 1);
            //cerr << v[i].first << " " << v[j].first << " : " << t << endl;
            ans += (t * (t-1)) / 2;
        }
        while (!hp.empty()) {
            update(hp.top().second, -1);
            hp.pop();
        }
    }
    cout << ans;

    return 0;
}


/**
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
**/

#include <bits/stdc++.h>

using namespace std;

typedef pair <long long ,long long>	PII;
typedef priority_queue<PII,vector<PII>,greater<PII>> pairMinHeap;
typedef priority_queue<PII> pairMaxHeap;
typedef priority_queue<long long ,vector<long long>,greater<long long>> minHeap;
typedef priority_queue<long long> maxHeap;

#define what_is(x) cerr <<#x<<" is "<<x<<endl;
#define wis(x,y) cerr <<#x<<" is "<<x<<" and "<<#y<<" is "<<y<<endl;

const long long MD=24;
inline long long mul(long long a, long long b){
    return (a*b)%MD;
}

inline long long po(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1)ans = mul(ans,a);
        a = mul(a,a);
        b/=2;
    }
    return ans;
}

long long INF=1e17;
const int N=1e5+22;

long long n,m,t,k;
long long arr[N];
long long x;
long long shift = 5100;
//string s[N];

vector<pair<int , pair<int,int>>> v,h;

int tree[N+10];

void update(int x, int val) {
    while (x <= N){
        tree[x] += val;
        x += (x & -x);
    }
}

long long get(int x) {
    long long ans = 0;
    while (x > 0){
        ans += tree[x];
        x -= (x & -x);
    }
    return ans;
}

int main(){
    ios::sync_with_stdio(false);

    cin >> n;

    for (int i = 0; i < n; i++) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        x1 += shift;
        x2 += shift;
        y1 += shift;
        y2 += shift;
        if (x1 == x2) {
            v.push_back({x1, {min(y1, y2), max(y1, y2)}});
        } else {
            h.push_back({y1, {min(x1, x2), max(x1,x2)}});
        }
    }
    sort(v.begin(), v.end());
    long long ans = 0;
    for (int i = 0; i < (int)v.size(); i++) {
        pairMaxHeap hp;
        for (auto x : h) {
            if (x.first <= v[i].second.second && x.first >= v[i].second.first && x.second.first <= v[i].first) {
                hp.push({x.second.second, x.first});
                update(x.first, 1);
            }
        }
        for (int j = i+1; j < (int)v.size() && !hp.empty(); j++) {
            while (!hp.empty() && hp.top().first < v[j].first) {
                update(hp.top().second, -1);
                hp.pop();
            }
            long long t = get(v[j].second.second) - get(v[j].second.first - 1);
            //cerr << v[i].first << " " << v[j].first << " : " << t << endl;
            ans += (t * (t-1)) / 2;
        }
        while (!hp.empty()) {
            update(hp.top().second, -1);
            hp.pop();
        }
    }
    cout << ans;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

struct node{
	int po,z1,z2;
	node(){}
	node(int _po,int _z1,int _z2) : po(_po),z1(_z1),z2(_z2){}
};

int n;
long long ans;
vector<node>heng,shu;
bitset<5005>b[5005];

int main(){
	int x1,y1,x2,y2;
	scanf("%d",&n);
	for(int i=1;i<=5002;i++) b[i].reset();
	for(int i=1;i<=n;i++){
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		if(x1>x2) swap(x1,x2);
		if(y1>y2) swap(y1,y2);
		if(x1==x2){
			shu.push_back(node(x1,y1,y2));
		}
		else heng.push_back(node(y1,x1,x2));
	}
	for(int i=0;i<heng.size();i++){
		for(int j=0;j<shu.size();j++){
			if(heng[i].po>=shu[j].z1 && heng[i].po<=shu[j].z2 && shu[j].po>=heng[i].z1 && shu[j].po<=heng[i].z2){
				b[i].set(j);
			}
		}
	}
	for(int i=0;i<heng.size();i++){
		for(int j=0;j<i;j++){
			int t=(b[i]&b[j]).count();
			ans=ans+t*(t-1)/2;
		}
	}
	printf("%lld",ans);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

struct node{
	int po,z1,z2;
	node(){}
	node(int _po,int _z1,int _z2) : po(_po),z1(_z1),z2(_z2){}
};

int n,ans;
vector<node>heng,shu;
bitset<5005>b[5005];

int main(){
	int x1,y1,x2,y2;
	scanf("%d",&n);
	for(int i=1;i<=5002;i++) b[i].reset();
	for(int i=1;i<=n;i++){
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		if(x1>x2) swap(x1,x2);
		if(y1>y2) swap(y1,y2);
		if(x1==x2){
			shu.push_back(node(x1,y1,y2));
		}
		else heng.push_back(node(y1,x1,x2));
	}
	for(int i=0;i<heng.size();i++){
		for(int j=0;j<shu.size();j++){
			if(heng[i].po>=shu[j].z1 && heng[i].po<=shu[j].z2 && shu[j].po>=heng[i].z1 && shu[j].po<=heng[i].z2){
				b[i].set(j);
			}
		}
	}
	for(int i=0;i<heng.size();i++){
		for(int j=0;j<i;j++){
			int t=(b[i]&b[j]).count();
			if(t>=2) ans=ans+t*(t-1)/2;
		}
	}
	printf("%d",ans);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

struct node{
	int po,z1,z2;
	node(){}
	node(int _po,int _z1,int _z2) : po(_po),z1(_z1),z2(_z2){}
};

int n;
long long ans;
vector<node>heng,shu;
bitset<5005>b[5005];

int main(){
	int x1,y1,x2,y2;
	scanf("%d",&n);
	for(int i=1;i<=5002;i++) b[i].reset();
	for(int i=1;i<=n;i++){
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		if(x1>x2) swap(x1,x2);
		if(y1>y2) swap(y1,y2);
		if(x1==x2){
			shu.push_back(node(x1,y1,y2));
		}
		else heng.push_back(node(y1,x1,x2));
	}
	if(heng.size()>shu.size()) swap(heng,shu);
	for(int i=0;i<heng.size();i++){
		for(int j=0;j<shu.size();j++){
			if(heng[i].po>=shu[j].z1 && heng[i].po<=shu[j].z2 && shu[j].po>=heng[i].z1 && shu[j].po<=heng[i].z2){
				b[i].set(j);
			}
		}
	}
	for(int i=0;i<heng.size();i++){
		for(int j=0;j<i;j++){
			int t=(b[i]&b[j]).count();
			ans=ans+t*(t-1)/2;
		}
	}
	printf("%lld",ans);
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

struct node{
	int po,z1,z2;
	node(){}
	node(int _po,int _z1,int _z2) : po(_po),z1(_z1),z2(_z2){}
};

int n,ans;
vector<node>heng,shu;
bitset<5005>b[5005];

int main(){
	int x1,y1,x2,y2;
	scanf("%d",&n);
	for(int i=1;i<=5002;i++) b[i].reset();
	for(int i=1;i<=n;i++){
		scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
		if(x1>x2) swap(x1,x2);
		if(y1>y2) swap(y1,y2);
		if(x1==x2){
			shu.push_back(node(x1,y1,y2));
		}
		else heng.push_back(node(y1,x1,x2));
	}
	for(int i=0;i<heng.size();i++){
		for(int j=0;j<shu.size();j++){
			if(heng[i].po>=shu[j].z1 && heng[i].po<=shu[j].z2 && shu[j].po>=heng[i].z1 && shu[j].po<=heng[i].z2){
				b[i].set(j);
			}
		}
	}
	for(int i=0;i<heng.size();i++){
		for(int j=0;j<i;j++){
			int t=(b[i]&b[j]).count();
			ans=ans+t*(t-1)/2;
		}
	}
	printf("%d",ans);
	return 0;
}


#include <bits/stdc++.h>
#define ll long long

using namespace std;

typedef struct{
    int xp, yp, xk, yk;
} Duz;

bool cmph(Duz d1, Duz d2)
{
    return d1.yp<d2.yp;
}

bool cmpv(Duz d1, Duz d2)
{
    return d1.xp<d2.xp;
}

int fenwick[100000];

// vraca sumu elemenata od pocetka niza do pozicije i (niz indeksiran od 1)
int sum(int i) {
	int sum = 0;

	while(i > 0) {
		sum += fenwick[i];
		i -= i & -i;
	}

	return sum;
}

// povecava vrednost u nizu na poziciji i za x
void update(int i, int x) {
	while(i < 100010) {
		fenwick[i] += x;
		i += i & -i;
	}
}

int n;
vector<Duz> horizontalne;
vector<Duz> vertikalne;
vector<pair<int,int> > preseci;

ll sol=0;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int x1,y1,x2,y2;
	cin>>n;
	for(int i=0;i<n;i++)
    {
        cin>>x1>>y1>>x2>>y2;
        if(x1==x2)
            vertikalne.push_back({x1+5002,min(y1,y2)+5002, x1+5002, max(y1,y2)+5002});
        else
            horizontalne.push_back({min(x1,x2)+5002, y1+5002,max(x1,x2)+5002, y1+5002});
    }
    sort(horizontalne.begin(),horizontalne.end(),cmph);
    sort(vertikalne.begin(),vertikalne.end(),cmpv);

    for(int i=0;i<horizontalne.size();i++)
    {
        int y=horizontalne[i].yp;
        int xp=horizontalne[i].xp;
        int xk=horizontalne[i].xk;
        preseci.clear();
        for(int j=0;j<10010;j++)
            fenwick[j]=0;
        for(int j=0;j<vertikalne.size();j++)
            if(vertikalne[j].yp<=y)
                update(vertikalne[j].xk,1), preseci.push_back(make_pair(vertikalne[j].yk, vertikalne[j].xp));
        sort(preseci.begin(),preseci.end());
        int ind=0;
        int m=preseci.size();
        for(int j=i+1;j<horizontalne.size();j++)
        {
            while(ind<m && preseci[ind].first<horizontalne[j].yp)
                update(preseci[ind].second,-1), ind++;
            ll tek=sum(min(xk,horizontalne[j].xk))-sum(max(xp,horizontalne[j].xp)-1);
            sol+=(tek*(tek-1))/2;
        }

    }

    cout<<sol;

	return 0;
}


#include <bits/stdc++.h>
#define ll long long

using namespace std;

typedef struct{
    int xp, yp, xk, yk;
} Duz;

bool cmph(Duz d1, Duz d2)
{
    return d1.yp<d2.yp;
}

bool cmpv(Duz d1, Duz d2)
{
    return d1.xp<d2.xp;
}

int fenwick[100000];

// vraca sumu elemenata od pocetka niza do pozicije i (niz indeksiran od 1)
int sum(int i) {
	int sum = 0;

	while(i > 0) {
		sum += fenwick[i];
		i -= i & -i;
	}

	return sum;
}

// povecava vrednost u nizu na poziciji i za x
void update(int i, int x) {
	while(i < 10010) {
		fenwick[i] += x;
		i += i & -i;
	}
}

int n;
vector<Duz> horizontalne;
vector<Duz> vertikalne;
vector<pair<int,int> > preseci;

ll sol=0;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int x1,y1,x2,y2;
	cin>>n;
	for(int i=0;i<n;i++)
    {
        cin>>x1>>y1>>x2>>y2;
        if(x1==x2)
            vertikalne.push_back({x1+5002,min(y1,y2)+5002, x1+5002, max(y1,y2)+5002});
        else
            horizontalne.push_back({min(x1,x2)+5002, y1+5002,max(x1,x2)+5002, y1+5002});
    }
    sort(horizontalne.begin(),horizontalne.end(),cmph);
    sort(vertikalne.begin(),vertikalne.end(),cmpv);

    for(int i=0;i<horizontalne.size();i++)
    {
        int y=horizontalne[i].yp;
        int xp=horizontalne[i].xp;
        int xk=horizontalne[i].xk;
        preseci.clear();
        for(int j=0;j<10020;j++)
            fenwick[j]=0;
        for(int j=0;j<vertikalne.size();j++)
            if(vertikalne[j].yp<=y)
                update(vertikalne[j].xk,1), preseci.push_back(make_pair(vertikalne[j].yk, vertikalne[j].xp));
        sort(preseci.begin(),preseci.end());
        int ind=0;
        int m=preseci.size();
        for(int j=i+1;j<horizontalne.size();j++)
        {
            while(ind<m && preseci[ind].first<horizontalne[j].yp)
                update(preseci[ind].second,-1), ind++;
            ll tek=sum(min(xk,horizontalne[j].xk))-sum(max(xp,horizontalne[j].xp)-1);
            sol+=(tek*(tek-1))/2;
        }

    }

    cout<<sol;

	return 0;
}


#include <bits/stdc++.h>
#define ll long long

using namespace std;

typedef struct{
    int xp, yp, xk, yk;
} Duz;

bool cmph(Duz d1, Duz d2)
{
    return d1.yp<d2.yp;
}

bool cmpv(Duz d1, Duz d2)
{
    return d1.xp<d2.xp;
}

int fenwick[100000];

// vraca sumu elemenata od pocetka niza do pozicije i (niz indeksiran od 1)
int sum(int i) {
	int sum = 0;

	while(i > 0) {
		sum += fenwick[i];
		i -= i & -i;
	}

	return sum;
}

// povecava vrednost u nizu na poziciji i za x
void update(int i, int x) {
	while(i < 100010) {
		fenwick[i] += x;
		i += i & -i;
	}
}

int n;
vector<Duz> horizontalne;
vector<Duz> vertikalne;
vector<pair<int,int> > preseci;

ll sol=0;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int x1,y1,x2,y2;
	cin>>n;
	for(int i=0;i<n;i++)
    {
        cin>>x1>>y1>>x2>>y2;
        if(x1==x2)
            vertikalne.push_back({x1+5001,min(y1,y2)+5001, x1+5001, max(y1,y2)+5001});
        else
            horizontalne.push_back({min(x1,x2)+5001, y1+5001,max(x1,x2)+5001, y1+5001});
    }
    sort(horizontalne.begin(),horizontalne.end(),cmph);
    sort(vertikalne.begin(),vertikalne.end(),cmpv);

    for(int i=0;i<horizontalne.size();i++)
    {
        int y=horizontalne[i].yp;
        int xp=horizontalne[i].xp;
        int xk=horizontalne[i].xk;
        preseci.clear();
        for(int j=0;j<10010;j++)
            fenwick[j]=0;
        for(int j=0;j<vertikalne.size();j++)
            if(vertikalne[j].yp<=y)
                update(vertikalne[j].xk,1), preseci.push_back(make_pair(vertikalne[j].yk, vertikalne[j].xp));
        sort(preseci.begin(),preseci.end());
        int ind=0;
        int m=preseci.size();
        for(int j=i+1;j<horizontalne.size();j++)
        {
            while(ind<m && preseci[ind].first<horizontalne[j].yp)
                update(preseci[ind].second,-1), ind++;
            ll tek=sum(min(xk,horizontalne[j].xk))-sum(max(xp,horizontalne[j].xp)-1);
            sol+=(tek*(tek-1))/2;
        }

    }

    cout<<sol;

	return 0;
}


#include <bits/stdc++.h>
#define ll long long

using namespace std;

typedef struct{
    int xp, yp, xk, yk;
} Duz;

bool cmph(Duz d1, Duz d2)
{
    return d1.yp<d2.yp;
}

bool cmpv(Duz d1, Duz d2)
{
    return d1.xp<d2.xp;
}

int fenwick[100000];

// vraca sumu elemenata od pocetka niza do pozicije i (niz indeksiran od 1)
int sum(int i) {
	int sum = 0;

	while(i > 0) {
		sum += fenwick[i];
		i -= i & -i;
	}

	return sum;
}

// povecava vrednost u nizu na poziciji i za x
void update(int i, int x) {
	while(i < 10010) {
		fenwick[i] += x;
		i += i & -i;
	}
}

int n;
vector<Duz> horizontalne;
vector<Duz> vertikalne;
vector<pair<int,int> > preseci;

ll sol=0;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);

	int x1,y1,x2,y2;
	cin>>n;
	for(int i=0;i<n;i++)
    {
        cin>>x1>>y1>>x2>>y2;
        if(x1==x2)
            vertikalne.push_back({x1+5002,min(y1,y2)+5002, x1+5002, max(y1,y2)+5002});
        else
            horizontalne.push_back({min(x1,x2)+5002, y1+5002,max(x1,x2)+5002, y1+5002});
    }
    sort(horizontalne.begin(),horizontalne.end(),cmph);
    sort(vertikalne.begin(),vertikalne.end(),cmpv);

    for(int i=0;i<horizontalne.size();i++)
    {
        int y=horizontalne[i].yp;
        int xp=horizontalne[i].xp;
        int xk=horizontalne[i].xk;
        preseci.clear();
        for(int j=0;j<10020;j++)
            fenwick[j]=0;
        for(int j=0;j<vertikalne.size();j++)
            if(vertikalne[j].yp<=y)
                update(vertikalne[j].xk,1), preseci.push_back(make_pair(vertikalne[j].yk, vertikalne[j].xp));
        sort(preseci.begin(),preseci.end());
        int ind=0;
        int m=preseci.size();
        for(int j=i+1;j<horizontalne.size();j++)
        {
            while(ind<m && preseci[ind].first<horizontalne[j].yp)
                update(preseci[ind].second,-1), ind++;
            int r=min(xk,horizontalne[j].xk);
            int l=max(xp,horizontalne[j].xp);
            ll tek=0;
            if((xp>=horizontalne[j].xp && xp<=horizontalne[j].xk) || (horizontalne[j].xp>=xp && horizontalne[j].xp<=xk))
               tek=sum(r)-sum(l-1);
            sol+=(tek*(tek-1))/2;
        }

    }

    cout<<sol;

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
vector<pipii> h, v;
int x[5005], y[5005], xx[5005], yy[5005];

int ft[10005];
void update(int i, int v){
    for(;i<=10001;i+=(i&-i)){
        ft[i] += v;
    }
}
int query(int i){
    int res = 0;
    for(;i>0;i-=(i&-i)) res+=ft[i];
    return res;
}

int main(){
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++){
        scanf("%d%d%d%d", &x[i], &y[i], &xx[i], &yy[i]);
        x[i]+=5001;
        xx[i]+=5001;
        y[i]+=5001;
        yy[i]+=5001;
        if(y[i] == yy[i]) h.push_back(pipii(y[i], pii(min(x[i], xx[i]), max(x[i], xx[i]))));
        else v.push_back(pipii(x[i], pii(min(y[i], yy[i]), max(y[i], yy[i]))));
    }
    sort(h.begin(), h.end());
    sort(v.begin(), v.end());

    vector<pii> hh;
    for(int i=0;i<h.size();i++){
        int y = h[i].first, x1 = h[i].second.first, x2 = h[i].second.second;
        hh.push_back(pii(x2, i));
    }
    sort(hh.begin(), hh.end());
    LL ans = 0;
    for(int i=0;i<v.size();i++){
        int x = v[i].first, y1 = v[i].second.first, y2 = v[i].second.second;
        memset(ft, 0, sizeof(ft));

        for(int j=0;j<hh.size();j++){
            if(hh[j].first >= x){
                int k = hh[j].second;
                int y = h[k].first, x1 = h[k].second.first, x2 = h[k].second.second;
                if(x1 <= x){
                    update(y, 1);
                }
            }
            else break;
        }

        int k = 0;
        for(int j=i+1;j<v.size();j++){
            int xx = v[j].first, yy1 = v[j].second.first, yy2 = v[j].second.second;

            while(k < hh.size() && hh[k].first < xx){
                int kk = hh[j].second;
                int y = h[kk].first, x1 = h[kk].second.first, x2 = h[kk].second.second;
                update(y, -1);
                k++;
            }
            if(y1 <= yy2 && yy1 <= y2){
                int mn = max(y1, yy1);
                int mx = min(y2, yy2);
                int res = query(mx) - query(mn-1);
                ans = ans + res*1ll*(res-1)/2;
            }
        }
    }
    printf("%lld\n", ans);
}


#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<int, pii> pipii;
vector<pipii> h, v;
int x[5005], y[5005], xx[5005], yy[5005];

int ft[10005];
void update(int i, int v){
    for(;i<=10000;i+=(i&-i)){
        ft[i] += v;
    }
}
int query(int i){
    int res = 0;
    for(;i>0;i-=(i&-i)) res+=ft[i];
    return res;
}

int main(){
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++){
        scanf("%d%d%d%d", &x[i], &y[i], &xx[i], &yy[i]);
        x[i]+=5001;
        xx[i]+=5001;
        y[i]+=5001;
        yy[i]+=5001;
        if(y[i] == yy[i]) h.push_back(pipii(y[i], pii(min(x[i], xx[i]), max(x[i], xx[i]))));
        else v.push_back(pipii(x[i], pii(min(y[i], yy[i]), max(y[i], yy[i]))));
    }
    sort(h.begin(), h.end());
    sort(v.begin(), v.end());

    vector<pii> hh;
    for(int i=0;i<h.size();i++){
        int y = h[i].first, x1 = h[i].second.first, x2 = h[i].second.second;
        hh.push_back(pii(x2, i));
    }
    sort(hh.begin(), hh.end());
    LL ans = 0;
    for(int i=0;i<v.size();i++){
        int x = v[i].first, y1 = v[i].second.first, y2 = v[i].second.second;
        memset(ft, 0, sizeof(ft));

        for(int j=0;j<hh.size();j++){
            if(hh[j].first >= x){
                int k = hh[j].second;
                int y = h[k].first, x1 = h[k].second.first, x2 = h[k].second.second;
                if(x1 <= x){
                    update(y, 1);
                }
            }
            else break;
        }

        int k = 0;
        for(int j=i+1;j<v.size();j++){
            int xx = v[j].first, yy1 = v[j].second.first, yy2 = v[j].second.second;

            while(k < hh.size() && hh[k].first < xx){
                int kk = hh[j].second;
                int y = h[kk].first, x1 = h[kk].second.first, x2 = h[kk].second.second;
                update(y, -1);
                k++;
            }
            if(y1 <= yy2 && yy1 <= y2){
                int mn = max(y1, yy1);
                int mx = min(y2, yy2);
                int res = query(mx) - query(mn-1);
                ans = ans + res*1ll*(res-1)/2;
            }
        }
    }
    printf("%lld\n", ans);
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solve(in, out);
        out.close();
	}

	private static void solve(InputReader in, PrintWriter out) {
		int t = in.nextInt();
		while (t-- > 0) {
			int h = in.nextInt(), c = in.nextInt(), temp = in.nextInt();
			if (temp <= (h + c) / 2) {
				out.println(2);
				continue;
			}
			long k = getK(h, c , temp);
			out.println(k);
		}
	}

	private static long getK(int h, int c, int t) {
		int a = h - t;
		int b = 2 * t - c - h;
		int k = 2 * (a / b) + 1;
		long val1 = Math.abs(k / 2 * 1l * c + (k + 1) / 2 * 1l * h - t * 1l * k);
		long val2 = Math.abs((k + 2) / 2 * 1l * c + (k + 3) / 2 * 1l * h - t * 1l * (k + 2));
		return val1 * (k + 2) <= val2 * k ? k : k + 2;
	}

	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class CF1359C {
    public static void main(String[] args) {
        FastReader input = new FastReader();
        int t = input.nextInt();
        while (t > 0){
            long hot = input.nextLong();
            long cold = input.nextLong();
            long desired = input.nextLong();

            if(hot == desired){
                System.out.println(1);
            }
            else if((hot + cold) >= 2 * desired){
                System.out.println(2);
            }
            else{

                long x = ((desired - cold) / ((2 * desired) - hot - cold));

                long y = x + 1;

                double lower = ((x * hot) + (x - 1) * cold) / (1.0 * (2 * x - 1));
                double upper = ((y * hot) + (y - 1) * cold) / (1.0 * (2 * y - 1));

                double d1 = Math.abs(desired * 1L * (2 * x - 1) - (x * (cold + hot) - cold)) / (2 * x - 1.0);
                double d2 = Math.abs(desired * 1L * (2 * y - 1) - (y * (cold + hot) - cold)) / (2 * y - 1.0);

                if(d1 <= d2){
                    System.out.println(2 * x - 1);
                }
                else {
                    System.out.println(2 * y - 1);
                }

            }
            t--;
        }
    }
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class CF1359C {
    public static void main(String[] args) {
        FastReader input = new FastReader();
        int t = input.nextInt();
        while (t > 0){
            double hot = input.nextDouble();
            double cold = input.nextDouble();
            double desired = input.nextDouble();

            if(hot == desired){
                System.out.println(1);
            }
            else if((hot + cold) / 2 == desired){
                System.out.println(2);
            }
            else{

                double option1 = Math.abs(((hot + cold) / 2) - desired);

                long x = (long)((desired - cold) / ((2 * desired) - hot - cold));

                long y = x + 1;

                double lower = ((x * hot) + (x - 1) * cold) / (1.0 * (2 * x - 1));
                double upper = ((y * hot) + (y - 1) * cold) / (1.0 * (2 * y - 1));

                double option2 = Math.abs(desired - lower);
                double option3 = Math.abs(upper - desired);

                if(option1 <= option2 && option1 <= option3){
                    System.out.println(2);
                }
                else{
                    if(option2 <= option3){
                        System.out.println(2 * x - 1);
                    }
                    else{
                        System.out.println(2 * y - 1);
                    }
                }

            }
            t--;
        }
    }
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class CF1359C {
    public static void main(String[] args) {
        FastReader input = new FastReader();
        int t = input.nextInt();
        while (t > 0){
            double hot = input.nextDouble();
            double cold = input.nextDouble();
            double desired = input.nextDouble();

            if(hot == desired){
                System.out.println(1);
            }
            else if((hot + cold) >= 2 * desired){
                System.out.println(2);
            }
            else{

                long x = (long)((desired - cold) / ((2 * desired) - hot - cold));

                long y = x + 1;

                double lower = ((x * hot) + (x - 1) * cold) / (1.0 * (2 * x - 1));
                double upper = ((y * hot) + (y - 1) * cold) / (1.0 * (2 * y - 1));

                double option2 = Math.abs(desired - lower);
                double option3 = Math.abs(upper - desired);

                if(option2 <= option3){
                    System.out.println(2 * x - 1);
                }
                else {
                    System.out.println(2 * y - 1);
                }

            }
            t--;
        }
    }
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(sum==temp) {
				pr.println(2); continue;
			}
			if(h==temp) {
				pr.println(1); continue;
			}
			double close = h-temp;
			long times = 1;
			if(h>temp & sum/2.0<temp) {
				long low = 0;
				long high = (long)1e18;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/(2*mid+1);
					if(ans-temp>=0) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/(2*low+1);
				double s2 = (h+(double)sum*high)/(2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.00000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				if(Math.abs((double)sum/2-temp)<=close+0.00000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
			}
			if(h*1.0-temp>Math.abs((double)sum/2-temp)){
				pr.println(2);
			}
			else {
				pr.println(1);
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			double close = h-temp;
			int times = 1;
			long sum = h;
			for(int i = 2; i<1000; i++) {
				if(i%2==0) {
					sum+=c;
					if(close-Math.abs((double)sum/i-temp)>0.0000001) {
						close = Math.abs((double)sum/i-temp);
						times = i;
					}
				}
				else {
					sum+=h;
					if(close-Math.abs((double)sum/i-temp)>0.0000001) {
						close = Math.abs((double)sum/i-temp);
						times = i;
					}
				}
			}
			pr.println(times);
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		loop:
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(h==temp) {
				pr.println(1); continue;
			}
			if(sum==temp*2) {
				pr.println(2); continue;
			}
			if((double)sum/2>temp) {
				pr.println(2); continue;
			}
			double close = 0;
			long times = 0;
			if(h>temp & (double)sum/2<temp) {
				long low = 0;
				long high = (long)1e9;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/(2*mid+1);
					if(Math.abs(ans-temp)<=0.000000000000001) {
						pr.println(2*mid+1);
						continue loop;
					}
					if(ans-temp>0.000000000000001) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/((long)2*low+1);
				double s2 = (h+(double)sum*high)/((long)2*high+1);

				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.000000000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				if(low>6)
					for(int i = -5; i<=5; i++) {
						double an = (h+(double)sum*(low+i))/(2*(low+i)+1);
						if(Math.abs(an-temp)<=close+0.000000000000001) {
							close = Math.abs(an-temp);
							times = 2*(low+i)+1;
						}
					}
				pr.println(times);
				/*

				if(Math.abs((double)sum/2-temp)<=close+0.00000000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)+0.00000000001) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
				*/
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(h==temp) {
				pr.println(1); continue;
			}
			if(sum/2.0==temp) {
				pr.println(2); continue;
			}
			double close = h-temp;
			long times = 1;
			if(h>temp & sum/2.0<temp) {
				long low = 0;
				long high = (long)1e18;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/(2*mid+1);
					if(ans-temp>=0) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/(2*low+1);
				double s2 = (h+(double)sum*high)/(2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.00000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				if(Math.abs((double)sum/2-temp)<=close+0.00000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
			}
			if(h*1.0-temp>Math.abs((double)sum/2-temp+0.00000000001)){
				pr.println(2);
			}
			else {
				pr.println(1);
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(sum/2.0==temp) {
				pr.println(2); continue;
			}
			if(h==temp) {
				pr.println(1); continue;
			}
			double close = h-temp;
			long times = 1;
			if(h>temp & sum/2.0<temp) {
				long low = 0;
				long high = (long)1e18;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/(2*mid+1);
					if(ans-temp>=0) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/(2*low+1);
				double s2 = (h+(double)sum*high)/(2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.00000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				if(Math.abs((double)sum/2-temp)<=close+0.00000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
			}
			if(h*1.0-temp>Math.abs((double)sum/2-temp+0.00000000001)){
				pr.println(2);
			}
			else {
				pr.println(1);
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		loop:
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(h==temp) {
				pr.println(1); continue;
			}
			if(sum==temp*2) {
				pr.println(2); continue;
			}
			if((double)sum/2>temp) {
				pr.println(2); continue;
			}
			double close = 0;
			long times = 0;
			if(h>temp & (double)sum/2<temp) {
				long low = 0;
				long high = (long)1e9;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/(2*mid+1);
					if(Math.abs(ans-temp)<=0.000000000000001) {
						pr.println(2*mid+1);
						continue loop;
					}
					if(ans-temp>0.000000000000001) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/((long)2*low+1);
				double s2 = (h+(double)sum*high)/((long)2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.000000000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				pr.println(times);
				/*

				if(Math.abs((double)sum/2-temp)<=close+0.00000000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)+0.00000000001) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
				*/
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(h==temp) {
				pr.println(1); continue;
			}
			if(sum==temp*2) {
				pr.println(2); continue;
			}
			if((double)sum/2>temp) {
				pr.println(2); continue;
			}
			double close = 0;
			long times = 0;
			if(h>temp & (double)sum/2<temp) {
				long low = 0;
				long high = (long)1e15;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/((long)2*mid+1);
					if(ans-temp>=0) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/((long)2*low+1);
				double s2 = (h+(double)sum*high)/((long)2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.00000000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				pr.println(times);
				/*

				if(Math.abs((double)sum/2-temp)<=close+0.00000000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)+0.00000000001) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
				*/
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		loop:
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(h==temp) {
				pr.println(1); continue;
			}
			if(sum==temp*2) {
				pr.println(2); continue;
			}
			if((double)sum/2>temp) {
				pr.println(2); continue;
			}
			double close = 0;
			long times = 0;
			if(h>temp & (double)sum/2<temp) {
				long low = 0;
				long high = (long)1e15;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/((long)2*mid+1);
					if(Math.abs(ans-temp)<0.000000000000001) {
						pr.println(2*mid+1);
						continue loop;
					}
					if(ans-temp>-0.000000000000001) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/((long)2*low+1);
				double s2 = (h+(double)sum*high)/((long)2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.000000000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				pr.println(times);
				/*

				if(Math.abs((double)sum/2-temp)<=close+0.00000000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)+0.00000000001) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
				*/
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			double close = h-temp;
			int times = 1;
			long sum = h;
			for(int i = 2; i<6000; i++) {
				if(i%2==0) {
					sum+=c;
					if(close-Math.abs((double)sum/i-temp)>0.0000001) {
						close = Math.abs((double)sum/i-temp);
						times = i;
					}
				}
				else {
					sum+=h;
					if(close-Math.abs((double)sum/i-temp)>0.0000001) {
						close = Math.abs((double)sum/i-temp);
						times = i;
					}
				}
			}
			pr.println(times);
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(h==temp) {
				pr.println(1); continue;
			}
			if(sum==temp*2) {
				pr.println(2); continue;
			}
			double close = 0;
			long times = 0;
			if(h>temp & sum/2.0<temp) {
				long low = 0;
				long high = (long)4e18;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/(2*mid+1);
					if(ans-temp>=0) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/(2*low+1);
				double s2 = (h+(double)sum*high)/(2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.00000000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				if(Math.abs((double)sum/2-temp)<=close+0.00000000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)+0.00000000001) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
			}
			if(h*1.0-temp>Math.abs((double)sum/2-temp+0.00000000001)){
				pr.println(2);
			}
			else {
				pr.println(1);
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(sum==temp) {
				pr.println(2); continue;
			}
			if(h==temp) {
				pr.println(1); continue;
			}
			double close = h-temp;
			int times = 1;
			if(h>temp & sum/2.0<temp) {
				int low = 0;
				int high = (int)1e9;
				int mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/(2*mid+1);
					if(ans-temp>=0) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/(2*low+1);
				double s2 = (h+(double)sum*high)/(2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.00000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				if(Math.abs((double)sum/2-temp)<=close+0.00000000001) {
					pr.println(2);
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
			}
			if(h*1.0-temp>Math.abs((double)sum/2-temp)){
				pr.println(2);
			}
			else {
				pr.println(1);
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(h==temp) {
				pr.println(1); continue;
			}
			if(sum==temp*2) {
				pr.println(2); continue;
			}
			double close = 0;
			long times = 0;
			if(h>temp & sum/2.0<temp) {
				long low = 0;
				long high = (long)9e18;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/(2*mid+1);
					if(ans-temp>=0) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/(2*low+1);
				double s2 = (h+(double)sum*high)/(2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.00000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				if(Math.abs((double)sum/2-temp)<=close+0.00000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
			}
			if(h*1.0-temp>Math.abs((double)sum/2-temp+0.00000000001)){
				pr.println(2);
			}
			else {
				pr.println(1);
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(h==temp) {
				pr.println(1); continue;
			}
			if(sum==temp*2) {
				pr.println(2); continue;
			}
			if((double)sum/2>temp) {
				pr.println(2); continue;
			}
			double close = 0;
			long times = 0;
			if(h>temp & (double)sum/2<temp) {
				long low = 0;
				long high = (long)1e15;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/((long)2*mid+1);
					if(ans-temp>=-0.00000000001) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/((long)2*low+1);
				double s2 = (h+(double)sum*high)/((long)2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.00000000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				pr.println(times);
				/*

				if(Math.abs((double)sum/2-temp)<=close+0.00000000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)+0.00000000001) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
				*/
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		loop:
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(h==temp) {
				pr.println(1); continue;
			}
			if(sum==temp*2) {
				pr.println(2); continue;
			}
			if((double)sum/2>temp) {
				pr.println(2); continue;
			}
			double close = 0;
			long times = 0;
			if(h>temp & (double)sum/2<temp) {
				long low = 0;
				long high = (long)1e9;
				long mid = (low+high)/2;
				while(low<=high) {
					double ans = (h+(double)sum*mid)/(2*mid+1);
					if(Math.abs(ans-temp)<=0.000000000000001) {
						pr.println(2*mid+1);
						continue loop;
					}
					if(ans-temp>0.000000000000001) {
						low = mid +1;
					}
					else {
						high = mid-1;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/((long)2*low+1);
				double s2 = (h+(double)sum*high)/((long)2*high+1);
				for(int i = -5; i<=5; i++) {

				}
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.000000000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				pr.println(times);
				/*

				if(Math.abs((double)sum/2-temp)<=close+0.00000000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)+0.00000000001) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
				*/
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			double close = h-temp;
			int times = 1;
			long sum = h;
			for(int i = 2; i<2000; i++) {
				if(i%2==0) {
					sum+=c;
					if(close-Math.abs((double)sum/i-temp)>0.00000000001) {
						close = Math.abs((double)sum/i-temp);
						times = i;
					}
				}
				else {
					sum+=h;
					if(close-Math.abs((double)sum/i-temp)>0.00000000001) {
						close = Math.abs((double)sum/i-temp);
						times = i;
					}
				}
			}
			pr.println(times);
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		loop:
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(h==temp) {
				pr.println(1); continue;
			}
			if(sum==temp*2) {
				pr.println(2); continue;
			}
			if((double)sum/2>temp) {
				pr.println(2); continue;
			}
			double close = 0;
			long times = 0;
			if(h>temp & (double)sum/2<temp) {
				long low = 0;
				long high = (long)1e15;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/((long)2*mid+1);
					if(Math.abs(ans-temp)<=0.00000000001) {
						pr.println(2*mid+1);
						continue loop;
					}
					if(ans-temp>=-0.00000000001) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/((long)2*low+1);
				double s2 = (h+(double)sum*high)/((long)2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.00000000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				pr.println(times);
				/*

				if(Math.abs((double)sum/2-temp)<=close+0.00000000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)+0.00000000001) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
				*/
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		loop:
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(h==temp) {
				pr.println(1); continue;
			}
			if(sum==temp*2) {
				pr.println(2); continue;
			}
			if((double)sum/2>temp) {
				pr.println(2); continue;
			}
			double close = 0;
			long times = 0;
			if(h>temp & (double)sum/2<temp) {
				long low = 0;
				long high = (long)1e15;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/((long)2*mid+1);
					if(Math.abs(ans-temp)<=0.000000000000001) {
						pr.println(2*mid+1);
						continue loop;
					}
					if(ans-temp>=-0.000000000000001) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/((long)2*low+1);
				double s2 = (h+(double)sum*high)/((long)2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.0000000000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				pr.println(times);
				/*

				if(Math.abs((double)sum/2-temp)<=close+0.00000000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)+0.00000000001) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
				*/
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(sum==temp) {
				pr.println(2); continue;
			}
			if(h==temp) {
				pr.println(1); continue;
			}
			double close = h-temp;
			int times = 1;
			if(h>temp & sum/2.0<temp) {
				int low = 0;
				int high = (int)1e9;
				int mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/(2*mid+1);
					if(ans-temp>=0) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/(2*low+1);
				double s2 = (h+(double)sum*high)/(2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.00000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				if(Math.abs((double)sum/2-temp)<=close+0.00000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
			}
			if(h*1.0-temp>Math.abs((double)sum/2-temp)){
				pr.println(2);
			}
			else {
				pr.println(1);
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}


import java.util.*;
import java.io.*;
public class C1359 {
	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static StringTokenizer st;
	public static void main(String[]args)throws IOException {
		int t = readInt();
		while(t--!=0) {
			int h = readInt(); int c = readInt(); int temp = readInt();
			int sum = h+c;
			if(h==temp) {
				pr.println(1); continue;
			}
			if(sum==temp*2) {
				pr.println(2); continue;
			}
			if(sum/2.0>temp) {
				pr.println(2); continue;
			}
			double close = 0;
			long times = 0;
			if(h>temp & sum/2.0<temp) {
				long low = 0;
				long high = (long)4e18;
				long mid = (low+high)/2;
				while(low<high-1) {
					double ans = (h+(double)sum*mid)/(2*mid+1);
					if(ans-temp>=0) {
						low = mid;
					}
					else {
						high = mid;
					}
					mid = (low+high)/2;
				}
				double s1 = (h+(double)sum*low)/(2*low+1);
				double s2 = (h+(double)sum*high)/(2*high+1);
				if(Math.abs(s1-temp)<=Math.abs(s2-temp)+0.00000000000001) {
					close = Math.abs(s1-temp);
					times = 2*low+1;
				}
				else {
					close = Math.abs(s2-temp);
					times = 2*high+1;
				}
				pr.println(times);
				/*

				if(Math.abs((double)sum/2-temp)<=close+0.00000000000001) {
					if(h-temp<=Math.abs((double)sum/2-temp)+0.00000000001) {
						pr.println(1);
					}
					else {
						pr.println(2);
					}
					continue;
				}
				else {
					pr.println(times);
					continue;
				}
				*/
			}
		}
		pr.close();
	}
	static String next () throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}
	static long readLong () throws IOException {
		return Long.parseLong(next());
	}
	static int readInt () throws IOException {
		return Integer.parseInt(next());
	}
	static double readDouble () throws IOException {
		return Double.parseDouble(next());
	}
	static char readCharacter () throws IOException {
		return next().charAt(0);
	}
	static String readLine () throws IOException {
		return br.readLine().trim();
	}
}