#include<stdio.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
#include<stdlib.h>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<iostream>
#include<cctype>
#include<map>
#include<stack>
#include<cstdlib>
#include<queue>
#include<vector>
#include<algorithm>
#include<bitset>
#include<algorithm>
#include<set>
#include<limits.h>
#include <sstream>

//#include <bits/stdc++.h>

using namespace std;
typedef long int LD;
typedef long long int LLD;
typedef float F;
typedef double LF;
typedef unsigned int U;
typedef unsigned long int LU;
typedef unsigned long long int LLU;
typedef char C;

/*----------simple input section ------------ */
#define sf scanf
#define sfi(x) scanf("%d",&x)
#define sfc(x) scanf("%c",&x)
#define sfi2(x,y) scanf("%d%d",&x,&y)
#define sfll2(x,y) scanf("%lld%lld",&x,&y)
#define sfu2(x,y) scanf("%llu%llu",&x,&y)
#define sfl(x) scanf("%ld",&x)
#define sfll(x) scanf("%lld",&x)
#define sfd(x) scanf("%lf",&x)
#define sfu(x) scanf("%llu",&x)
#define sfs(x) scanf("%s",x)

/*----------simple input section ------------ */
#define pf printf
#define pfi(x) printf("%d\n",x)
#define pfl(x) printf("%ld\n",x)
#define pfll(x) printf("%lld\n",x)
#define pfu(x) printf("%llu\n",x)
#define pfs(x) printf("%s\n",x)
#define pfc(x) printf("%c\n",x)
#define pfd(x) printf("%lf\n",x)

/*----------file input section ------------ */

#define f_input  freopen("input.txt","r",stdin);
#define f_output freopen("output.txt","w",stdout);

#define pb(x) push_back(x)
#define PI acos(-1.0)
#define sq(x) (x)*(x)
#define mem(x,y) memset(x,y,sizeof(x))
#define TEST int cs,T;sfi(T);getchar();for(cs=1;cs<=T;cs++)
#define nn printf("\n")
// xx-> diagonal -> 8 horizontal/vertical->4

const int xx[] = {0, 1, 0, -1, -1, 1, -1, 1};
const int yy[] = {1, 0, -1, 0, 1, 1, -1, -1};

// KX-> Knight moves
const int kx[] = {-2, -1, 1, 2, 2, 1, -1, -2};
const int ky[] = {1, 2, 2, 1, -1, -2, -2, -1};

/******** debug **********/
#define chk1 printf("hi......1  \n")
#define chk2 printf("hi......2  \n")

template<class T> T power(T N,T P)
{
    return (P==0)?  1: N*power(N,P-1);   //N^P
}

#define mod  1000000007
#define eps 10e-8
#define sz 1005
#define sz1 30
#define sz2 1000005
/******* start my code ********/
class data
{
    public:
    int id,marks;
    data()
    {
        id=marks=0;
    }
};
data arr[sz];
bool compare(data a,data b)
{
    if(a.marks==b.marks)
        return a.id<b.id;
    else return a.marks>b.marks;
}
int main()
{
    int i,j,k,l,m,n;
    sfi(n);
    for(i=0;i<n;i++)
    {
        m=0;
        for(j=0;j<4;j++)
        {
            sfi(k);
            m+=k;
        }
        arr[i].id=i;
        arr[i].marks=m;
    }
    sort(arr,arr+n,compare);
    pfi(arr[0].id+1);
    return 0;
}

/*

*/


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
#include<stdlib.h>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<iostream>
#include<cctype>
#include<map>
#include<stack>
#include<cstdlib>
#include<queue>
#include<vector>
#include<algorithm>
#include<bitset>
#include<algorithm>
#include<set>
#include<limits.h>
#include <sstream>

//#include <bits/stdc++.h>

using namespace std;
typedef long int LD;
typedef long long int LLD;
typedef float F;
typedef double LF;
typedef unsigned int U;
typedef unsigned long int LU;
typedef unsigned long long int LLU;
typedef char C;

/*----------simple input section ------------ */
#define sf scanf
#define sfi(x) scanf("%d",&x)
#define sfc(x) scanf("%c",&x)
#define sfi2(x,y) scanf("%d%d",&x,&y)
#define sfll2(x,y) scanf("%lld%lld",&x,&y)
#define sfu2(x,y) scanf("%llu%llu",&x,&y)
#define sfl(x) scanf("%ld",&x)
#define sfll(x) scanf("%lld",&x)
#define sfd(x) scanf("%lf",&x)
#define sfu(x) scanf("%llu",&x)
#define sfs(x) scanf("%s",x)

/*----------simple input section ------------ */
#define pf printf
#define pfi(x) printf("%d\n",x)
#define pfl(x) printf("%ld\n",x)
#define pfll(x) printf("%lld\n",x)
#define pfu(x) printf("%llu\n",x)
#define pfs(x) printf("%s\n",x)
#define pfc(x) printf("%c\n",x)
#define pfd(x) printf("%lf\n",x)

/*----------file input section ------------ */

#define f_input  freopen("input.txt","r",stdin);
#define f_output freopen("output.txt","w",stdout);

#define pb(x) push_back(x)
#define PI acos(-1.0)
#define sq(x) (x)*(x)
#define mem(x,y) memset(x,y,sizeof(x))
#define TEST int cs,T;sfi(T);getchar();for(cs=1;cs<=T;cs++)
#define nn printf("\n")
// xx-> diagonal -> 8 horizontal/vertical->4

const int xx[] = {0, 1, 0, -1, -1, 1, -1, 1};
const int yy[] = {1, 0, -1, 0, 1, 1, -1, -1};

// KX-> Knight moves
const int kx[] = {-2, -1, 1, 2, 2, 1, -1, -2};
const int ky[] = {1, 2, 2, 1, -1, -2, -2, -1};

/******** debug **********/
#define chk1 printf("hi......1  \n")
#define chk2 printf("hi......2  \n")

template<class T> T power(T N,T P)
{
    return (P==0)?  1: N*power(N,P-1);   //N^P
}

#define mod  1000000007
#define eps 10e-8
#define sz 1005
#define sz1 30
#define sz2 1000005
/******* start my code ********/
class data
{
    public:
    int id,marks;
    data()
    {
        id=marks=0;
    }
};
data arr[sz];
bool compare(data a,data b)
{
    if(a.marks==b.marks)
        return a.id<b.id;
    else return a.marks>b.marks;
}
int main()
{
    int i,j,k,l,m,n;
    sfi(n);
    for(i=0;i<n;i++)
    {
        m=0;
        for(j=0;j<4;j++)
        {
            sfi(k);
            m+=k;
        }
        arr[i].id=i;
        arr[i].marks=m;
    }
    sort(arr,arr+n,compare);
    for(i=0;i<n;i++)
    {
        if(arr[i].id==1)
        {
            m=i;
            break;
        }
    }
    pfi(m);
    return 0;
}

/*

*/


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<ctype.h>
#include<stdlib.h>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<iostream>
#include<cctype>
#include<map>
#include<stack>
#include<cstdlib>
#include<queue>
#include<vector>
#include<algorithm>
#include<bitset>
#include<algorithm>
#include<set>
#include<limits.h>
#include <sstream>

//#include <bits/stdc++.h>

using namespace std;
typedef long int LD;
typedef long long int LLD;
typedef float F;
typedef double LF;
typedef unsigned int U;
typedef unsigned long int LU;
typedef unsigned long long int LLU;
typedef char C;

/*----------simple input section ------------ */
#define sf scanf
#define sfi(x) scanf("%d",&x)
#define sfc(x) scanf("%c",&x)
#define sfi2(x,y) scanf("%d%d",&x,&y)
#define sfll2(x,y) scanf("%lld%lld",&x,&y)
#define sfu2(x,y) scanf("%llu%llu",&x,&y)
#define sfl(x) scanf("%ld",&x)
#define sfll(x) scanf("%lld",&x)
#define sfd(x) scanf("%lf",&x)
#define sfu(x) scanf("%llu",&x)
#define sfs(x) scanf("%s",x)

/*----------simple input section ------------ */
#define pf printf
#define pfi(x) printf("%d\n",x)
#define pfl(x) printf("%ld\n",x)
#define pfll(x) printf("%lld\n",x)
#define pfu(x) printf("%llu\n",x)
#define pfs(x) printf("%s\n",x)
#define pfc(x) printf("%c\n",x)
#define pfd(x) printf("%lf\n",x)

/*----------file input section ------------ */

#define f_input  freopen("input.txt","r",stdin);
#define f_output freopen("output.txt","w",stdout);

#define pb(x) push_back(x)
#define PI acos(-1.0)
#define sq(x) (x)*(x)
#define mem(x,y) memset(x,y,sizeof(x))
#define TEST int cs,T;sfi(T);getchar();for(cs=1;cs<=T;cs++)
#define nn printf("\n")
// xx-> diagonal -> 8 horizontal/vertical->4

const int xx[] = {0, 1, 0, -1, -1, 1, -1, 1};
const int yy[] = {1, 0, -1, 0, 1, 1, -1, -1};

// KX-> Knight moves
const int kx[] = {-2, -1, 1, 2, 2, 1, -1, -2};
const int ky[] = {1, 2, 2, 1, -1, -2, -2, -1};

/******** debug **********/
#define chk1 printf("hi......1  \n")
#define chk2 printf("hi......2  \n")

template<class T> T power(T N,T P)
{
    return (P==0)?  1: N*power(N,P-1);   //N^P
}

#define mod  1000000007
#define eps 10e-8
#define sz 1005
#define sz1 30
#define sz2 1000005
/******* start my code ********/
class data
{
    public:
    int id,marks;
    data()
    {
        id=marks=0;
    }
};
data arr[sz];
bool compare(data a,data b)
{
    if(a.marks==b.marks)
        return a.id<b.id;
    else return a.marks>b.marks;
}
int main()
{
    int i,j,k,l,m,n;
    sfi(n);
    for(i=0;i<n;i++)
    {
        m=0;
        for(j=0;j<4;j++)
        {
            sfi(k);
            m+=k;
        }
        arr[i].id=i;
        arr[i].marks=m;
    }
    sort(arr,arr+n,compare);
    for(i=0;i<n;i++)
    {
        if(arr[i].id==0)
        {
            m=i+1;
            break;
        }
    }
    pfi(m);
    return 0;
}

/*

*/


#include <bits/stdc++.h>
using namespace std;
int a[1005][4];
int g[1005];
int main()
{
	int n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<4;j++)
		{
			cin >>a[i][j];
			g[i]=g[i]+a[i][j];
		}
	}
	//吴宫花草埋幽径，晋代衣冠成古丘。
	int sum=1;
	for(int i=1;i<n;i++)
	{
		if(g[i]>g[0])  sum++;
	}
	cout <<sum<<endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int a[1005];
int g[1005];
int main()
{
	int n,a1,a2,a3,a4;cin>>n;
	for(int i=0;i<n;i++)
	{
			cin >>a1>>a2>>a3>>a4;
			g[i]=a1+a2+a3+a4;
	}
	//吴宫花草埋幽径，晋代衣冠成古丘。
	int sum=1;
	for(int i=1;i<n;i++)
	{
		if(g[i]>g[0])  sum++;
	}
	cout <<sum<<endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct name
{
    int pre;
    int id;
}aa[1005];
bool cmp(name &a,name &b)
{
    return a.pre>b.pre;
}
int main()
{
    int T;
    while(cin>>T)
    {
        memset(aa,0,sizeof aa);
        for(int i=0;i<T;i++)
        {
            int a,b,c,d;
            cin>>a>>b>>c>>d;
            aa[i].pre=a+b+c+d;
            aa[i].id=i+1;
        }
        sort(aa,aa+T,cmp);
        cout<<aa[0].id<<endl;
    }
    return 0;

}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct name
{
    int pre;
    int id;
}aa[1005];
bool cmp(name &a,name &b)
{
    if(a.pre==b.pre)
    return a.id<b.id;
    return a.pre>b.pre;
}
int main()
{
    int T;
    while(cin>>T)
    {
        memset(aa,0,sizeof aa);
        for(int i=0;i<T;i++)
        {
            int a,b,c,d;
            cin>>a>>b>>c>>d;
            aa[i].pre=a+b+c+d;
            aa[i].id=i+1;
        }
        sort(aa,aa+T,cmp);
        cout<<aa[0].id<<endl;
    }
    return 0;

}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct name
{
    int pre;
    int id;
}aa[1005];
bool cmp(name &a,name &b)
{
    if(a.pre==b.pre)
    return a.id<b.id;
    return a.pre>b.pre;
}
int main()
{
    int T;
    while(cin>>T)
    {
        memset(aa,0,sizeof aa);
        for(int i=0;i<T;i++)
        {
            int a,b,c,d;
            cin>>a>>b>>c>>d;
            aa[i].pre=a+b+c+d;
            aa[i].id=i+1;
        }
        sort(aa,aa+T,cmp);
       for(int i=0;i<T;i++)
       {
           if(aa[i].id==1)
           {
            cout<<i+1<<endl;
           break;
           }

       }
    }
    return 0;
}


#include<bits/stdc++.h>
#define maxn 100001
using namespace std;
inline int read()
{
	char x = getchar();
	int lin = 0,f = 1;
	while(x < '0' || x > '9')
	{
		if(x == '-') f = -1;
		x = getchar();
	}
	while(x >= '0' && x <= '9')
	{
		lin = lin * 10 + x - '0';
		x = getchar();
	}
	return lin * f;
}
int n;
struct st{
	int a,b,c,d,val,num;
}s[maxn];
bool com(st a,st b)
{
	if(a.val == b.val)
		return a.num < b.num;
	return a.val > b.val;
}
int main(){
	n = read();
	for(int i = 1; i <= n; i++)
	{
		s[i].a = read(); s[i].b = read();
		s[i].c = read(); s[i].d = read();
		s[i].num = i;
		s[i].val = s[i].a + s[i].b + s[i].c + s[i].d;
	}
	sort(s+ 1,s + 1 + n,com);
	for(int i = 1; i <= n; i++)
		if(s[i].num == 1)
			printf("%d",s[i].num);
}


#include<bits/stdc++.h>
#define maxn 100001
using namespace std;
inline int read()
{
	char x = getchar();
	int lin = 0,f = 1;
	while(x < '0' || x > '9')
	{
		if(x == '-') f = -1;
		x = getchar();
	}
	while(x >= '0' && x <= '9')
	{
		lin = lin * 10 + x - '0';
		x = getchar();
	}
	return lin * f;
}
int n;
struct st{
	int a,b,c,d,val,num;
}s[maxn];
bool com(st a,st b)
{
	if(a.val == b.val)
		return a.num > b.num;
	return a.val > b.val;
}
int main(){
	n = read();
	for(int i = 1; i <= n; i++)
	{
		s[i].a = read(); s[i].b = read();
		s[i].c = read(); s[i].d = read();
		s[i].num = i;
		s[i].val = s[i].a + s[i].b + s[i].c + s[i].d;
	}
	sort(s+ 1,s + 1 + n,com);
	for(int i = 1; i <= n; i++)
		if(s[i].num == 1)
			printf("%d",s[i].num);
}


#include<bits/stdc++.h>
#define maxn 100001
using namespace std;
inline int read()
{
	char x = getchar();
	int lin = 0,f = 1;
	while(x < '0' || x > '9')
	{
		if(x == '-') f = -1;
		x = getchar();
	}
	while(x >= '0' && x <= '9')
	{
		lin = lin * 10 + x - '0';
		x = getchar();
	}
	return lin * f;
}
int n;
int a,b,c,d,val,valt,ans = 1;
int main(){
	n = read();
	a = read(); b = read(); c = read(); d = read();
	valt = a + b + c + d;
	for(int i = 2; i <= n; i++)
	{
		a = read(); b = read(); c = read(); d = read();
		val = a + b + c + d;
		if(val > valt) ++ans;
	}
	cout<<ans;
}


#include<bits/stdc++.h>
#define maxn 100001
using namespace std;
inline int read()
{
	char x = getchar();
	int lin = 0,f = 1;
	while(x < '0' || x > '9')
	{
		if(x == '-') f = -1;
		x = getchar();
	}
	while(x >= '0' && x <= '9')
	{
		lin = lin * 10 + x - '0';
		x = getchar();
	}
	return lin * f;
}
int n;
struct st{
	int a,b,c,d,val,num;
}s[maxn];
bool com(st a,st b)
{
	if(a.val == b.val)
		return a.num < b.num;
	return a.val > b.val;
}
int main(){
	n = read();
	for(int i = 1; i <= n; i++)
	{
		s[i].a = read(); s[i].b = read();
		s[i].c = read(); s[i].d = read();
		s[i].num = i;
		s[i].val = s[i].a + s[i].b + s[i].c + s[i].d;
	}
	sort(s+ 1,s + 1 + n,com);
	printf("%d",s[1].num);
}


#include<bits/stdc++.h>
#define maxn 100001
using namespace std;
inline int read()
{
	char x = getchar();
	int lin = 0,f = 1;
	while(x < '0' || x > '9')
	{
		if(x == '-') f = -1;
		x = getchar();
	}
	while(x >= '0' && x <= '9')
	{
		lin = lin * 10 + x - '0';
		x = getchar();
	}
	return lin * f;
}
int n;
struct st{
	int a,b,c,d,val,num;
}s[maxn];
bool com(st a,st b)
{
	if(a.val == b.val)
		return a.num > b.num;
	return a.val > b.val;
}
int main(){
	n = read();
	for(int i = 1; i <= n; i++)
	{
		s[i].a = read(); s[i].b = read();
		s[i].c = read(); s[i].d = read();
		s[i].num = i;
		s[i].val = s[i].a + s[i].b + s[i].c + s[i].d;
	}
	sort(s+ 1,s + 1 + n,com);
	for(int i = 1; i <= n; i++)
		if(s[i].num == 1)
			printf("%d",i);
}


#include<bits/stdc++.h>
#define maxn 100001
using namespace std;
inline int read()
{
	char x = getchar();
	int lin = 0,f = 1;
	while(x < '0' || x > '9')
	{
		if(x == '-') f = -1;
		x = getchar();
	}
	while(x >= '0' && x <= '9')
	{
		lin = lin * 10 + x - '0';
		x = getchar();
	}
	return lin * f;
}
int n;
int a,b,c,d,val,valt,ans = 1;
int main(){
	n = read();
	a = read(); b = read(); c = read(); d = read();
	valt = a + b + c + d;
	for(int i = 2; i <= n; i++)
	{
		a = read(); b = read(); c = read(); d = read();
		val = a + b + c + d;
		if(val >= valt) ++ans;
	}
	cout<<ans;
}


#include<bits/stdc++.h>
#define maxn 100001
using namespace std;
inline int read()
{
	char x = getchar();
	int lin = 0,f = 1;
	while(x < '0' || x > '9')
	{
		if(x == '-') f = -1;
		x = getchar();
	}
	while(x >= '0' && x <= '9')
	{
		lin = lin * 10 + x - '0';
		x = getchar();
	}
	return lin * f;
}
int n;
struct st{
	int a,b,c,d,val,num;
}s[maxn];
bool com(st a,st b)
{
	if(a.val == b.val)
		return a.num >b.num;
	return a.val > b.val;
}
int main(){
	n = read();
	for(int i = 1; i <= n; i++)
	{
		s[i].a = read(); s[i].b = read();
		s[i].c = read(); s[i].d = read();
		s[i].num = i;
		s[i].val = s[i].a + s[i].b + s[i].c + s[i].d;
	}
	sort(s+ 1,s + 1 + n,com);
	printf("%d",s[1].num);
}


#include "iostream"
using namespace std;
 int main()
 {
 	int number;
 	cin >> number;
 	int grade = 1;
 	int sum1;
	for(int i = 0; i < 4; i++)
	{
		int num = 0;
		cin >> num;
		sum1 += num;
	}
 	for(int i = 1; i < number; i++)
 	{
 		int sumone = 0;
 		for(int j = 0 ; j < 4; j++)
 		{
 			int num = 0;
 			cin >> num;
 			sumone += num;
		 }
		if(sumone > sum1)
		grade++;
	 }

	cout << grade << endl;
 	return 0;
 }


#include "iostream"
using namespace std;
 int main()
 {
 	int number;
 	cin >> number;
 	int grade = 1;
 	int sum1;
	for(int i = 0; i < 4; i++)
	{
		int num = 0;
		cin >> num;
		sum1 += num;
	}
 	for(int i = 1; i < number; i++)
 	{
 		int sumone = 0;
 		for(int j = 0 ; j < 4; j++)
 		{
 			int num = 0;
 			cin >> num;
 			sumone += num;
		 }
		if(sumone >= sum1)
		grade++;
	 }

	cout << grade << endl;
 	return 0;
 }


#include "iostream"
using namespace std;
 int main()
 {
 	int number;
 	while(cin >> number)
 	{
 		int grade = 1;
 	int sum1 = 0;
	for(int i = 0; i < 4; i++)
	{
		int num = 0;
		cin >> num;
		sum1 += num;
	}
 	for(int i = 1; i < number; i++)
 	{
 		int sumone = 0;
 		for(int j = 0 ; j < 4; j++)
 		{
 			int num = 0;
 			cin >> num;
 			sumone += num;
		 }
		if(sumone > sum1)
			grade++;
	 }

	cout << grade << endl;

	 }
 	return 0;
 }


#include<bits/stdc++.h>
using namespace std;
pair<int,int>p[1001];
map<int,int>m;
int main()
{
    int n,a[1001][5],sum;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
            sum=0;
        for(int j=1;j<=4;j++){
            scanf("%d",&a[i][j]);
            sum+=a[i][j];
        }
        m[sum]++;
      p[i].first=sum;
      p[i].second=i;
    }
    //cout<<p[0].second<<endl;
    sort(p+1,p+n+1);
    for(int i=1;i<=n;i++){
        if(p[i].second==1){
            if(m[p[i].first]!=0){
               for(int j=i+1;j<=n;j++){
                 if(p[j].first!=p[i].first){
                    cout<<n-j+2<<endl;
                    return 0;
                 }
               }
            }
            cout<<n-i+1<<endl;
            return 0;
            }
        }
}


#include<bits/stdc++.h>
using namespace std;
pair<int,int>p[1001];
map<int,int>m;
int main()
{
    int n,a[1001][5],sum;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
            sum=0;
        for(int j=0;j<4;j++){
            scanf("%d",&a[i][j]);
            sum+=a[i][j];
        }
        m[sum]++;
        p[i].first=sum;
        p[i].second=i;
    }
    sort(p,p+n);
    //for(int i=0;i<n;i++){
      //  cout<<p[i].first<<" "<<p[i].second<<endl;
    //}
    for(int i=n-1;i>=0;i--){
        if(p[i].second==0){
            if(m[p[i].first]!=0){
                for(int j=i;j<n;j++){
                    if(p[i].first!=p[j].first){
                        cout<<n-j+1<<endl;
                        return 0;
                    }
                    else if(j==n-1){
                        cout<<1<<endl;
                        return 0;
                    }
                }
            }
                cout<<n-i<<endl;
                return 0;
        }
    }
}


#include<bits/stdc++.h>
using namespace std;
pair<int,int>p[1001];
map<int,int>m;
int main()
{
    int n,a[1001][5],sum;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
            sum=0;
        for(int j=0;j<4;j++){
            scanf("%d",&a[i][j]);
            sum+=a[i][j];
        }
        m[sum]++;
        p[i].first=sum;
        p[i].second=i;
    }
    sort(p,p+n);
    for(int i=n-1;i>=0;i--){
        if(p[i].second==0){
            if(m[p[i].first]!=0){
                for(int j=i;j<n;j++){
                    if(p[i].first!=p[j].first){
                        cout<<n-j+1<<endl;
                        return 0;
                    }
                }
            }
                cout<<n-i<<endl;
                return 0;
        }
    }
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n1,n2,n3,n4,n,sum=0;
    cin>>n;
    vector< pair<int,int> >v;
    for(int i=0;i<n;i++)
    {
        cin>>n1>>n2>>n3>>n4;
        sum=n1+n2+n3+n4;
        v.push_back(make_pair(sum,i+1));

    }
   // sort(v.rbegin(),v.rend());
   for(int i=0;i<v.size()-1;i++)
   {
       if(v[i].first<v[i+1].first )
       {
           swap(v[i+1],v[i]);
       }
       else if((v[i].first == v[i+1].first) && (v[i].second > v[i+1].second))
       {
           swap(v[i+1],v[i]);
       }

   }
   /*for(int i=0;i<v.size();i++)
   {
       cout<<v[i].first<<" "<<v[i].second<<endl;
   }*/
    for(int i=0;i<v.size();i++)
    {
        if(v[i].second==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n1,n2,n3,n4,n,sum=0;
    cin>>n;
    pair<int,int> v[n+1];
    for(int i=0;i<n;i++)
    {
        cin>>n1>>n2>>n3>>n4;
        sum=n1+n2+n3+n4;
        //make_pair(sum,i+1));
        v[i].first=sum;
        v[i].second=i+1;

    }
   // sort(v.rbegin(),v.rend());
   for(int i=0;i<n-1;i++)
   {
       if(v[i].first<v[i+1].first || ((v[i].first == v[i+1].first) && (v[i].second > v[i+1].second)) )
       {
           swap(v[i+1],v[i]);
       }

   }
   /*for(int i=0;i<v.size();i++)
   {
       cout<<v[i].first<<" "<<v[i].second<<endl;
   }*/
    for(int i=0;i<n;i++)
    {
        if(v[i].second==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n1,n2,n3,n4,n,sum=0;
    cin>>n;
    vector< pair<int,int> >v;
    for(int i=0;i<n;i++)
    {
        cin>>n1>>n2>>n3>>n4;
        sum=n1+n2+n3+n4;
        v.push_back(make_pair(sum,i+1));

    }
   // sort(v.rbegin(),v.rend());
   for(int i=0;i<v.size()-1;i++)
   {
       if(v[i].first<v[i+1].first )
       {
           swap(v[i],v[i+1]);
       }
       else if(v[i].first == v[i+1].first && v[i].second > v[i+1].second)
       {
           swap(v[i],v[i+1]);
       }
   }
    for(int i=0;i<v.size();i++)
    {
        if(v[i].second==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n1,n2,n3,n4,n,sum=0;
    cin>>n;
    vector< pair<int,int> >v;
    for(int i=0;i<n;i++)
    {
        cin>>n1>>n2>>n3>>n4;
        sum=n1+n2+n3+n4;
        v.push_back(make_pair(sum,i+1));

    }
   // sort(v.rbegin(),v.rend());
   for(int i=0;i<v.size();i++)
   {
       if(v[i].first<v[i+1].first || ((v[i].first == v[i+1].first) && (v[i].second > v[i+1].second)) )
       {
           swap(v[i+1],v[i]);
       }

   }
   /*for(int i=0;i<v.size();i++)
   {
       cout<<v[i].first<<" "<<v[i].second<<endl;
   }*/
    for(int i=0;i<v.size();i++)
    {
        if(v[i].second==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n1,n2,n3,n4,n,sum=0;
    cin>>n;
    vector< pair<int,int> >v;
    for(int i=0;i<n;i++)
    {
        cin>>n1>>n2>>n3>>n4;
        sum=n1+n2+n3+n4;
        v.push_back(make_pair(sum,i+1));

    }
   // sort(v.rbegin(),v.rend());
   for(int i=0;i<v.size()-1;i++)
   {
       if(v[i].first<v[i+1].firsta )
       {
           swap(v[i],v[i+1]);
       }
   }
    for(int i=0;i<v.size();i++)
    {
        if(v[i].second==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n1,n2,n3,n4,n,sum=0;
    cin>>n;
    vector< pair<int,int> >v;
    for(int i=0;i<n;i++)
    {
        cin>>n1>>n2>>n3>>n4;
        sum=n1+n2+n3+n4;
        v.push_back(make_pair(sum,i+1));

    }
   // sort(v.rbegin(),v.rend());
   for(int i=0;i<v.size()-1;i++)
   {
       if(v[i].first<v[i+1].first )
       {
           swap(v[i+1],v[i]);
       }
      if((v[i].first == v[i+1].first) && (v[i].second > v[i+1].second))
       {
           swap(v[i+1],v[i]);
       }

   }
   /*for(int i=0;i<v.size();i++)
   {
       cout<<v[i].first<<" "<<v[i].second<<endl;
   }*/
    for(int i=0;i<v.size();i++)
    {
        if(v[i].second==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n1,n2,n3,n4,n,sum=0;
    cin>>n;
    vector< pair<int,int> >v;
    for(int i=0;i<n;i++)
    {
        cin>>n1>>n2>>n3>>n4;
        sum=n1+n2+n3+n4;
        v.push_back(make_pair(sum,i+1));

    }
   // sort(v.rbegin(),v.rend());
   for(int i=0;i<v.size()-1;i++)
   {
       if(v[i].first<v[i+1].first )
       {
           swap(v[i],v[i+1]);
       }
       else if(v[i].first == v[i+1].first && v[i].second > v[i+1].second)
       {
           swap(v[i],v[i+1]);
       }
       else
       {
           v[i]=v[i];
           v[i+1]=v[i+1];
       }
   }
   for(int i=0;i<v.size();i++)
   {
       cout<<v[i].first<<" "<<v[i].second<<endl;
   }
    for(int i=0;i<v.size();i++)
    {
        if(v[i].second==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n1,n2,n3,n4,n,sum=0,j=0;
    cin>>n;
    vector< pair<int,int> >v;
    for(int i=0;i<n;i++)
    {
        cin>>n1>>n2>>n3>>n4;
        sum=n1+n2+n3+n4;
        if(i==0)
            j=sum;
        v.push_back(make_pair(sum,i+1));

    }
   sort(v.rbegin(),v.rend());

   /*for(int i=0;i<v.size();i++)
   {
       cout<<v[i].first<<" "<<v[i].second<<endl;
   }*/
    for(int i=0;i<v.size();i++)
    {
        if(v[i].first==j)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n1,n2,n3,n4,n,sum=0;
    cin>>n;
    vector< pair<int,int> >v;
    for(int i=0;i<n;i++)
    {
        cin>>n1>>n2>>n3>>n4;
        sum=n1+n2+n3+n4;
        v.push_back(make_pair(sum,i+1));

    }
   // sort(v.rbegin(),v.rend());
   for(int i=0;i<v.size()-1;i++)
   {
       if(v[i].first<v[i+1].first )
       {
           swap(v[i],v[i+1]);
       }
       else if(v[i].first == v[i+1].first && v[i].second > v[i+1].second)
       {
           swap(v[i],v[i+1]);
       }
       else
       {
           v[i]=v[i];
           v[i+1]=v[i+1];
       }
   }
   /*for(int i=0;i<v.size();i++)
   {
       cout<<v[i].first<<" "<<v[i].second<<endl;
   }*/
    for(int i=0;i<v.size();i++)
    {
        if(v[i].second==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n1,n2,n3,n4,n,sum=0;
    cin>>n;
    vector< pair<int,int> >v;
    for(int i=0;i<n;i++)
    {
        cin>>n1>>n2>>n3>>n4;
        sum=n1+n2+n3+n4;
        v.push_back(make_pair(sum,i+1));

    }
   // sort(v.rbegin(),v.rend());
   for(int i=0;i<v.size()-1;i++)
   {
       if(v[i].first<v[i+1].first || ((v[i].first == v[i+1].first) && (v[i].second > v[i+1].second)) )
       {
           swap(v[i+1],v[i]);
       }

   }
   /*for(int i=0;i<v.size();i++)
   {
       cout<<v[i].first<<" "<<v[i].second<<endl;
   }*/
    for(int i=0;i<v.size();i++)
    {
        if(v[i].second==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n1,n2,n3,n4,n,sum=0;
    cin>>n;
    vector< pair<int,int> >v;
    for(int i=0;i<n;i++)
    {
        cin>>n1>>n2>>n3>>n4;
        sum=n1+n2+n3+n4;
        v.push_back(make_pair(sum,i+1));

    }
   // sort(v.rbegin(),v.rend());
   for(int i=0;i<v.size()-1;i++)
   {
       if(v[i].first<v[i+1].first )
       {
           swap(v[i],v[i+1]);
       }
   }
    for(int i=0;i<v.size();i++)
    {
        if(v[i].second==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std ;
#define maxn 1005
struct node{
    int sum;
    int id;
}aa[maxn];

bool cmp(node xx,node yy)
{
    if(xx.sum==yy.sum)
        return xx.id<yy.id;
    else
        return xx.sum>yy.sum;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int a,b,c,d;
        scanf("%d%d%d%d",&a,&b,&c,&d);
        int sum=0;
        sum=a+b+c+d;
        aa[i].sum=sum;
        aa[i].id=i;
    }
    sort(aa+1,aa+n,cmp);
    for(int i=1;i<=n;i++)
    {
        if(aa[i].id==1)
        {
            printf("%d\n",i);
            break;
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std ;
#define maxn 1005
struct node{
    int sum;
    int id;
}aa[maxn];

bool cmp(node xx,node yy)
{
    if(xx.sum==yy.sum)
        return xx.id<yy.id;
    else
        return xx.sum>yy.sum;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int a,b,c,d;
        scanf("%d%d%d%d",&a,&b,&c,&d);
        int sum=0;
        sum=a+b+c+d;
        aa[i].sum=sum;
        aa[i].id=i;
    }
    sort(aa+1,aa+n+1,cmp);
    for(int i=1;i<=n;i++)
    {
        if(aa[i].id==1)
        {
            printf("%d\n",i);
            break;
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std ;
#define maxn 1005
struct node{
    int sum;
    int id;
}aa[maxn];

bool cmp(node xx,node yy)
{
    if(xx.sum==yy.sum)
        return xx.id<yy.id;
    else
        return xx.sum>yy.sum;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int a,b,c,d;
        scanf("%d%d%d%d",&a,&b,&c,&d);
        int sum=0;
        sum=a+b+c+d;
        aa[i].sum=sum;
        aa[i].id=i;
    }
    sort(aa+1,aa+n,cmp);
    for(int i=1;i<=n;i++)
    {
        if(aa[i].id==1)
        {
            printf("%d\n",i);
            break;
        }
    }
    return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int n,sum,a,b,c,d,k=0;
	while(~scanf("%d",&n)){
		if(k)printf("\n");
		k++;
		int mark=1,max;
		for(int i=1;i<=n;i++){
			scanf("%d%d%d%d",&a,&b,&c,&d);
			if(i==1)max=a+b+c+d;
			else sum=a+b+c+d;
			if(i>1&&sum>max)mark++;
		}
		printf("%d\n",mark);
	}
}


#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int n,sum,a,b,c,d;
	while(~scanf("%d",&n)){
		int mark=0,max=-1;
		for(int i=1;i<=n;i++){
			scanf("%d%d%d%d",&a,&b,&c,&d);
			sum=a+b+c+d;
			if(sum>max){
				mark=i;
				max=sum;
			}
		}
		printf("%d\n",mark);
	}
}


#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int n,sum,a,b,c,d;
	while(~scanf("%d",&n)){
		int mark=0,max=-1;
		for(int i=1;i<=n;i++){
			scanf("%d%d%d%d",&a,&b,&c,&d);
			sum=a+b+c+d;
			if(sum>=max){
				mark=i;
				max=sum;
			}
		}
		printf("%d\n",mark);
	}
}


#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[])
{
	int n; cin >> n;
	vector<int> v;
	int a[n+1],temp,rank=1,y;
	for(int i=0;i<n;++i){
		for(int j=0;j<4;++j){
			cin >> temp;
			a[i] = a[i]+temp;
		}
		if(i=0)
			y = a[0];
	}
	sort(a,a+n);
	reverse(a,a+n);
	for(int i=0;i<n;++i)
		if(y == a[i]){
			cout<<i+1;
			break;
	}
	cout<<rank<<endl;
	return 0;
}


#include <iostream>
#include <math.h>
#include <stdio.h>
#include <vector>
#include <algorithm>

#define all(a) a.begin(),a.end()
using namespace std;
int main(int argc, char const *argv[])
{
	int n; scanf("%d",&n);
	vector<int> a;
	int temp,rank=1,y;
	for(int i=0;i<n;++i){
		y = 0;
		for(int j=0;j<4;++j){
			scanf("%d",&temp);
			y += temp;
		}
		a.push_back(y);

	}
	y = a[0];
	sort(all(a));

	reverse(all(a));
	for(int i=0;i<n;++i)
		if(y == a[i]){
			cout<<i+1;
			break;
	}
	//cout<<rank<<endl;
	return 0;
}


#include <iostream>
#include <math.h>
#include <stdio.h>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char const *argv[])
{
	int n; scanf("%d",&n);
	vector<int> v;
	int a[n+1],temp,rank=1,y;
	for(int i=0;i<n;++i){
		for(int j=0;j<4;++j){
			scanf("%d",&temp);
			a[i] = a[i]+temp;
		}
		if(i=0)
			y = a[0];
	}
	sort(a,a+n);
	reverse(a,a+n);
	for(int i=0;i<n;++i)
		if(y == a[i]){
			cout<<i+1;
			break;
	}
	//cout<<rank<<endl;
	return 0;
}


#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
	int n; cin >> n;
	int a[n+1],temp,rank=1;
	for(int i=0;i<n;++i){
		for(int j=0;j<4;++j){
			cin >> temp;
			a[i] = a[i]+temp;
		}
	}
	for(int i=1;i<n;++i){
		if(a[0] < a[i])
		rank++;
	}
	cout<<rank<<endl;
	return 0;
}


#include <iostream>
#include <math.h>
#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;
int main(int argc, char const *argv[])
{
	int n; scanf("%d",&n);
	int a[n+1];
	int temp,rank=1,y;
	for(int i=0;i<n;++i){
		y = 0;
		for(int j=0;j<4;++j){
			scanf("%d",&temp);
			y += temp;
		}
		a[i] = y;

	}
	y = a[0];
	sort(a,a+n);

	reverse(a,a+n);
	for(int i=0;i<n;++i)
		if(y == a[i]){
			cout<<i+1;
			break;
	}
	//cout<<rank<<endl;
	return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,r=0,r1,t=1,n,arr[100],ar[100];
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b>>c>>d;
        arr[i]=a+b+c+d;
        ar[i]=arr[i];
    }
    sort(ar,ar+n);
    for(int i=n-1;i>=0;i--)
    {
        if(arr[0]==ar[i])
        {
            cout<<t<<endl;
            break;
        }
        t++;
    }
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,r,t=0,n,arr[2];
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a>>b>>c>>d;
        r=a+b+c+d;
        if(i==0) arr[0]=r;
        if(r>arr[0])
            t++;
    }
        cout<<t+1<<endl;

}


#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d,r=0,r1,t=1,n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a>>b>>c>>d;
        r1=a+b+c+d;
        if(r<=r1)
        {
            r=r1;
            t=i;
        }
    }
    cout<<t<<endl;
}


#include<iostream>
#include <vector>
using namespace std;
vector<int> v;
int main(){
  int N, a, b, c, d;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a >> b >> c >> d;
    v.push_back(a + b + c + d);
  }
  int thomas = 0, rank = 0;
  for(int i = 1; i < N; i++){
    if(v[i] > v[thomas]) rank++;
  }
  cout << rank + 1;
}


#include<iostream>
#include <vector>
using namespace std;
vector<int> v;
int main(){
  int N, a, b, c, d;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a >> b >> c >> d;
    v.push_back(a + b + c + d);
  }
  int thomas = 0, rank = 0;
  for(int i = 1; i < N; i++){
    if(v[i] >= v[thomas]) rank++;
  }
  if(rank > 0) cout << rank;
  else cout << "1";
}


 #include<iostream>

using namespace std;

int main(){
       int N, a, b, c, d;
       cin >> N;
       int sum = 0, max = 0, thomas = 0;
       for(int i = 0; i < N; i++){
         cin >> a >> b >> c >> d;
         sum = a + b + c + d;
         if(sum > max) {
          max = sum;
          thomas = i;
         }
         sum = 0;
     }
     cout << thomas + 1;
}


#include<iostream>
#include <vector>
using namespace std;
vector<int> v;
int main(){
  int N, a, b, c, d;
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a >> b >> c >> d;
    v.push_back(a + b + c + d);
  }
  int thomas = 0, rank = 0;
  for(int i = 1; i < N; i++){
    if(v[i] > v[thomas]) rank++;
  }
  if(rank > 0) cout << rank;
  else cout << "1";
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >>n;
    int i,a[n],b[n],c[n],d[n],sum[n]={0},ans;
    set<int,greater<int> > s;
    set<int,greater<int> > :: iterator it;
    for(i=0;i<n;i++)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        sum[i]=a[i]+b[i]+c[i]+d[i];
     //   cout <<sum[i]<<endl;
        if(i==0)
            ans=sum[i];
        s.insert(sum[i]);
    }
    i=1;
    for(it=s.begin();it!=s.end();++it)
    {

        if(ans==*it)
        {
            cout <<i;
            break;
        }
        i++;
    }
}


5
100 98 100#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >>n;
    int i,a[n],b[n],c[n],d[n],sum[n]={0},ans;
  //  set<int,greater<int> > s;
  //  set<int,greater<int> > :: iterator it;
    for(i=0;i<n;i++)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        sum[i]=a[i]+b[i]+c[i]+d[i];
     //   cout <<sum[i]<<endl;
        if(i==0)
            ans=sum[i];
    }
    sort(sum,sum+n,greater<int>());
    for(i=0;i<n;i++)
    {
        if(sum[i]==ans)
        {
            cout <<i+1;
            break;
        }
    }
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >>n;
    int i,a[n],b[n],c[n],d[n],sum[n]={0},ans;
  //  set<int,greater<int> > s;
  //  set<int,greater<int> > :: iterator it;
    for(i=0;i<n;i++)
    {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        sum[i]=a[i]+b[i]+c[i]+d[i];
     //   cout <<sum[i]<<endl;
        if(i==0)
            ans=sum[i];
    }
    sort(sum,sum+n,greater<int>());
    for(i=0;i<n;i++)
    {
        if(sum[i]==ans)
        {
            cout <<i+1;
            break;
        }
    }
}


#include <map>
#include <set>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define eps 1e-8
#define PI acos(-1)
#define INF 0x3f3f3f3f
#define N 2000 + 10
using namespace std;
const int intN = 3e5 + 10 ;
typedef long long int LL;
const int dir[4][2]= { {1,0},{0,1},{-1,0},{0,-1} };

int GCD(int a,int b)
{
    return b ? GCD(b,a%b) : a;
}

struct STU
{
    int a,b,c,d,sum,num;
};
int cmp(struct STU a,struct STU b)
{
    if(a.sum==b.sum)
        return a.num<b.num;
    return a.sum>b.sum;
}

int main()
{
    struct STU s[N];
    int i,n;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d%d%d%d",&s[i].a,&s[i].b,&s[i].c,&s[i].d);
        s[i].sum=s[i].a+s[i].b+s[i].c+s[i].d;
        s[i].num=i;
    }
    sort(s,s+n,cmp);
    for(i=0;i<n;i++)
    {
        if(s[i].num==0)
        {
            printf("%d\n",i+1);
            break;
        }
    }
    return 0;
}


#include <iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
using namespace std;
typedef long long LL;
int main()
{
    LL a,b,c,d,n,i,sum1,sum,ans=0;
    scanf("%lld",&n);
    for(i=0;i<n;i++)
    {
        scanf("%lld%lld%lld%lld",&a,&b,&c,&d);
        sum=a+b+c+d;
        if(i==0)
            sum1=sum;
        else
            if(sum>sum1)
                ans++;
    }
    ans++;
    printf("%lld\n",ans);
    return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    int a,b,c,d,counts,sum,i;
    scanf("%d",&n);
    counts=1;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    sum=a+b+c+d;
    for(i=1;i<n;i++)
    {
        scanf("%d%d%d%d",&a,&b,&c,&d);
        if(sum<a+b+c+d)
        {
            counts++;
        }

    }
    printf("%d\n",counts);
}


#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
#define MAX 100000
#define memset(a,b) memset(a,b,sizeof(a))

//int main()
//{
//    int n,m,q;
//    string a,b;
//    cin>>n>>m>>q;
//    cin>>a>>b;
//    int sum=0;
//    for(int i=0; i<q; i++)
//    {
//        int c,d;
//        cin>>c>>d;
//        if(n<m)
//        {
//            printf("0\n");
//            continue;
//        }
//
//        else
//        {
//            if(d-c+1<m)
//            {
//                printf("0\n");
//                continue;
//            }
//
//            for(int j=c; j<=d;)
//            {
//                int ans=0;
//                for(int k=0; k<m; k++)
//                {
//                    if(a[j]==b[k])
//                    {
//                        ans++;
//                        j++;
//                    }
//                    else
//                        break;
//                }
//
//                if(ans==m)
//                    sum++;
//            }
//            cout<<sum<<endl;
//        }
//
//
//    }
//
//    return 0;
//
//}
//
struct node{
   int a,b,c,d,sum,num;
}nod[1050];
bool cmp(node p,node q)
{
    if(p.sum==q.sum)
        return p.num<q.num;
    return p.sum>q.sum;

}
int main()
{
    int m;
    cin>>m;
   // int z,x,n,v;
    for(int i=1;i<=m;i++)
    {
        cin>>nod[i].a>>nod[i].b>>nod[i].c>>nod[i].d;
        nod[i].num=i;
        nod[i].sum=nod[i].a+nod[i].b+nod[i].c+nod[i].d;
    }

    sort(nod+1,nod+m+1,cmp);
    for(int i=1;i<=m;i++)
    {
        if(nod[i].num==1)
        {
            cout<<i<<endl;
            break;
        }

    }
    return 0;

}


#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
struct sa
{
    int id;
    int cj[5];
    int sum;
}vis[1001];
int cmp(const sa &a,const sa &b)
{
    if (a.sum!=b.sum)
     return   a.sum>b.sum;
    else
       return a.id<b.id;
}
int main()
{
    int n;
    while(scanf("%d",&n)!=-1)
    {
        for(int i=1;i<=n;i++)

        {   vis[i].sum=0;
            vis[i].id=i;
            for(int j=1;j<=4;j++)
                {scanf("%d",&vis[i].cj[j]);
                 vis[i].sum+=vis[i].cj[j];
                }

        }
        sort(vis+1,vis+n,cmp);
        for(int i=1;i<=n;i++)
            if (vis[i].id==1)
        {
            printf("%d\n",i);
            break;
        }

    }

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
struct sa
{
    int id;
    int cj[5];
    int sum;
}vis[1001];
int cmp(const sa &a,const sa &b)
{
    if (a.sum!=b.sum)
     return   a.sum>b.sum;
    else
       return a.id<b.id;
}
int main()
{
    int n;
    scanf("%d",&n);

        for(int i=1;i<=n;i++)

        {   vis[i].sum=0;
            vis[i].id=i;
            for(int j=1;j<=4;j++)
                {scanf("%d",&vis[i].cj[j]);
                 vis[i].sum+=vis[i].cj[j];
                }

        }
        sort(vis+1,vis+n+1,cmp);
        for(int i=1;i<=n;i++)
            if (vis[i].id==1)
        {
            printf("%d\n",i);
            break;
        }

    return 0;
}


#include <iostream>
#include <stdio.h>
#include <algorithm>
using namespace std;
struct sa
{
    int id;
    int cj[5];
    int sum;
}vis[1001];
int cmp(const sa &a,const sa &b)
{
    if (a.sum!=b.sum)
     return   a.sum>b.sum;
    else
       return a.id<b.id;
}
int main()
{
    int n;
    scanf("%d",&n);

        for(int i=1;i<=n;i++)

        {   vis[i].sum=0;
            vis[i].id=i;
            for(int j=1;j<=4;j++)
                {scanf("%d",&vis[i].cj[j]);
                 vis[i].sum+=vis[i].cj[j];
                }

        }
        sort(vis+1,vis+n,cmp);
        for(int i=1;i<=n;i++)
            if (vis[i].id==1)
        {
            printf("%d\n",i);
            break;
        }

    return 0;
}


#include<bits/stdc++.h>
//#include<my.h>
#define ll long long
#define UP(a,b,i) for(int i=(a);i<=(b);i++)
#define DOWN(a,b,i) for(int i=(a);i>=(b);i--)
#define rep(a,b,i) UP(a,b-1,i)
#define Enter() printf("\n");
#define DEBUG printf("Passing [%s] in LINE %d...\n",__FUNCTION__,__LINE__)
using namespace std;
int ma=0x80000000;
int mi=0x7fffffff;
const ll zfc=0xffffffff;
const ll mod=1e9+7;
ll n,a,b,c,d,e;
struct rank
{
	ll shu,bh,pm;
}f[10005];
bool cmp(rank x,rank y)
{
	return x.shu>y.shu||x.shu==y.shu&&x.bh<y.bh;
}
bool cmd(rank x,rank y)
{
	return x.bh<y.bh;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a>>b>>c>>d;
		f[i].shu=a+b+c+d;
		f[i].bh=i;
	}
	sort(f+1,f+n+1,cmp);
	for(int i=1;i<=n;i++)
	f[i].pm=i;
	sort(f+1,f+n+1,cmd);
	cout<<f[1].pm;
	Enter();
    return 0;
}


#include<bits/stdc++.h>
//#include<my.h>
#define ll long long
#define UP(a,b,i) for(int i=(a);i<=(b);i++)
#define DOWN(a,b,i) for(int i=(a);i>=(b);i--)
#define rep(a,b,i) UP(a,b-1,i)
#define Enter() printf("\n");
#define DEBUG printf("Passing [%s] in LINE %d...\n",__FUNCTION__,__LINE__)
using namespace std;
int ma=0x80000000;
int mi=0x7fffffff;
const ll zfc=0xffffffff;
const ll mod=1e9+7;
ll n,a,b,c,d,e;
struct rank
{
	ll shu,bh,pm;
}f[10005];
bool cmp(rank x,rank y)
{
	return x.shu>y.shu||x.shu==y.shu&&x.bh<y.bh;
}
bool cmd(rank x,rank


#include<bits/stdc++.h>
//#include<my.h>
#define ll long long
#define UP(a,b,i) for(int i=(a);i<=(b);i++)
#define DOWN(a,b,i) for(int i=(a);i>=(b);i--)
#define rep(a,b,i) UP(a,b-1,i)
#define Enter() printf("\n");
#define DEBUG printf("Passing [%s] in LINE %d...\n",__FUNCTION__,__LINE__)
using namespace std;
int ma=0x80000000;
int mi=0x7fffffff;
const ll zfc=0xffffffff;
const ll mod=1e9+7;
ll n,a,b,c,d,e;
struct rank
{
	ll shu,bh,pm;
}f[10005];
bool cmp(rank x,rank y)
{
	return x.shu>y.shu;
}
bool cmd(rank x,rank y)
{
	return x.bh<y.bh;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a>>b>>c>>d;
		f[i].shu=a+b+c+d;
		f[i].bh=i;
	}
	sort(f+1,f+n+1,cmp);
	for(int i=1;i<=n;i++)
	f[i].pm=i;
	sort(f+1,f+n+1,cmd);
	cout<<f[1].pm;
	Enter();
    return 0;
}


#include <iostream>
#include <cstdio>

#define endl "\n"

using namespace std;

int c[1001][1001], a[1001], b[1001], n, i, j, sum, nom;

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

    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n;
    for (i = 1; i <= n; i++)
        for (j = 1; j <= 4; j++) cin >> c[i][j];

    for (i = 1; i <= n; i++) {
        sum = 0;
        for (j = 1; j <= 4; j++) sum += c[i][j];
        a[i] = sum;
        b[i] = i;
    }

        for (j = 1; j <= n; j++)
    for (i = j; i <= n - 1; i++)
        if (a[j] < a[i + 1]) {
            swap(a[j], a[i + 1]);
            swap(b[j], b[i + 1]);
    }

    for (i = 1; i <= n; i++)
        if (b[i] == 1) {
            nom = i;
            break;
    }

    cout << nom << endl;

    return 0;
}


#include <iostream>
#include <cstdio>

#define endl "\n"

using namespace std;

int c[1001][1001], a[1001], b[1001], n, i, j, sum, nom;

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

    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> n;
    for (i = 1; i <= n; i++)
        for (j = 1; j <= 4; j++) cin >> c[i][j];

    for (i = 1; i <= n; i++) {
        sum = 0;
        for (j = 1; j <= 4; j++) sum += c[i][j];
        a[i] = sum;
        b[i] = i;
    }

        for (j = 1; j <= n; j++)
    for (i = j; i <= n - 1; i++)
        if (a[j] < a[i + 1]) {
            swap(a[j], a[i + 1]);
            swap(b[j], b[i + 1]);
    }
    else if (a[j] == a[i + 1]) {
        if (b[j] > b[i + 1]) swap(b[j], b[i + 1]);
    }

    for (i = 1; i <= n; i++)
        if (b[i] == 1) {
            nom = i;
            break;
    }

    cout << nom << endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define READ freopen("in.txt","r",stdin)
#define WRITE() freopen("out.txt","w",stdout);
#define pb push_back
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define sf(x) scanf("%d",&x)
#define sf2(x,y) scanf("%d %d",&x,&y)
#define sl(x) scanf("%lld",&x)
#define sl2(x,y) scanf("%lld %lld",&x,&y)
#define sd(x) scanf("%lf",&x);
#define pii pair<int,int>
#define sl2(x,y) scanf("%lld %lld",&x,&y)
#define ff first
#define sn second
#define PRINT_CASE  printf("Case %d: ",tc++)
typedef long long ll;
typedef long long int lln;
//typedef long long lld;
const double pi=acos(-1.0);
int fx[]={1,-1,0,0}; //direction array
int fy[]={0,0,1,-1};
int dir[4][2]={1,0,-1,0,0,-1,0,1};

//#define INF 10000
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}

//vector<int>G[100];

//map<int,vector<int> >G;
//map<int,int>level;

ll mod=1e9+7;
struct st{
    int id;
    ll sum;
};
bool cmp(st a,st b)
{
    if(a.sum==b.sum)
    {
       return a.id<b.id;
    }
    return a.sum>b.sum;

}

st arr[20000];
int main()
{
//    READ;
    int n;
    sf(n);
    int a,b,c,d;
    for(int i=0;i<n;i++)
    {
        sf2(a,b);
        sf2(c,d);
        arr[i].id=i+1;
        arr[i].sum=a+b+c+d;

    }
    sort(arr,arr+n,cmp);
    for(int i=0;i<n;i++)
    {
        if(arr[i].id==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define READ freopen("in.txt","r",stdin)
#define WRITE() freopen("out.txt","w",stdout);
#define pb push_back
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define sf(x) scanf("%d",&x)
#define sf2(x,y) scanf("%d %d",&x,&y)
#define sl(x) scanf("%lld",&x)
#define sl2(x,y) scanf("%lld %lld",&x,&y)
#define sd(x) scanf("%lf",&x);
#define pii pair<int,int>
#define sl2(x,y) scanf("%lld %lld",&x,&y)
#define ff first
#define sn second
#define PRINT_CASE  printf("Case %d: ",tc++)
typedef long long ll;
typedef long long int lln;
//typedef long long lld;
const double pi=acos(-1.0);
int fx[]={1,-1,0,0}; //direction array
int fy[]={0,0,1,-1};
int dir[4][2]={1,0,-1,0,0,-1,0,1};

//#define INF 10000
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}

//vector<int>G[100];

//map<int,vector<int> >G;
//map<int,int>level;

ll mod=1e9+7;
struct st{
    int id;
    ll sum=0;
};
bool cmp(st a,st b)
{
    if(a.sum==b.sum)
    {
        a.id<b.id;
    }
    return a.sum>b.sum;

}

st arr[20000];
int main()
{
//    READ;
    int n;
    sf(n);
    int a,b,c,d;
    for(int i=0;i<n;i++)
    {
        sf2(a,b);
        sf2(c,d);
        arr[i].id=i+1;
        arr[i].sum=a+b+c+d;

    }
    sort(arr,arr+n,cmp);
    for(int i=0;i<n;i++)
    {
        if(arr[i].id==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define READ freopen("in.txt","r",stdin)
#define WRITE() freopen("out.txt","w",stdout);
#define pb push_back
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define sf(x) scanf("%d",&x)
#define sf2(x,y) scanf("%d %d",&x,&y)
#define sl(x) scanf("%lld",&x)
#define sl2(x,y) scanf("%lld %lld",&x,&y)
#define sd(x) scanf("%lf",&x);
#define pii pair<int,int>
#define sl2(x,y) scanf("%lld %lld",&x,&y)
#define ff first
#define sn second
#define PRINT_CASE  printf("Case %d: ",tc++)
typedef long long ll;
typedef long long int lln;
//typedef long long lld;
const double pi=acos(-1.0);
int fx[]={1,-1,0,0}; //direction array
int fy[]={0,0,1,-1};
int dir[4][2]={1,0,-1,0,0,-1,0,1};

//#define INF 10000
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll lcm(ll a,ll b)
{
    return a/gcd(a,b)*b;
}

//vector<int>G[100];

//map<int,vector<int> >G;
//map<int,int>level;

ll mod=1e9+7;
struct st{
    int id;
    ll sum;
};
bool cmp(st a,st b)
{
    if(a.sum==b.sum)
    {
        a.id<b.id;
    }
    return a.sum>b.sum;

}

st arr[20000];
int main()
{
//    READ;
    int n;
    sf(n);
    int a,b,c,d;
    for(int i=0;i<n;i++)
    {
        sf2(a,b);
        sf2(c,d);
        arr[i].id=i+1;
        arr[i].sum=a+b+c+d;

    }
    sort(arr,arr+n,cmp);
    for(int i=0;i<n;i++)
    {
        if(arr[i].id==1)
        {
            cout<<i+1<<endl;
            return 0;
        }
    }

    return 0;
}


#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
using namespace std;
int n;
struct data{
	long long sum;
	int id;
	friend bool operator <(const data &a,const data &b) {return a.sum==b.sum?a.id<b.id:a.sum>b.sum;}
}num[1000010];
long long a,b,c,d;
int ans=1;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld%lld%lld%lld",&a,&b,&c,&d),num[i].id=i,num[i].sum=a+b+c+d;
	sort(num+1,num+n+1);
//	for(int i=1;i<=n;i++) printf("%lld %d\n",num[i].sum,num[i].id);
	for(int i=1;i<=n;i++) if(num[i].id!=1) ans++;else break;
//	for(int i=ans;i>=)
	printf("%d",ans);
}


#include <iostream>
#include <algorithm>

using namespace std;

int main ()
 {
 	int n, i, c, temp, a[100][100], j, x = 0, sum = 0, k = 0, b[1010], pos;

 	cin >> n;

 	for (i = 1; i <= n; i++){
 		for (j = 1; j <= 4; j++){
 			cin >> a[i][j];
 			}
 		}

 		for (i = 1; i <= n; i++){
 			sum = 0;
 		for (j = 1; j <= 4; j++){
 			  sum+=a[i][j];
 			}
 			k++;
 			b[k] = sum;
 		}

 		c = b[1];

 		sort (b, b+k+1);

 		for (i = k; i >= 1; i--){

 		x++;
 		if (b[i] == c){

 			pos = x;
 			break;
 		 }

 		}

 		cout << pos << endl;

	return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main ()
 {
 	int n, i, c, temp, a[1010][1010], j, x = 0, sum = 0, k = 0, b[1010], pos;

 	cin >> n;

 	for (i = 1; i <= n; i++){
 		for (j = 1; j <= 4; j++){
 			cin >> a[i][j];
 			}
 		}

 		for (i = 1; i <= n; i++){
 			sum = 0;
 		for (j = 1; j <= 4; j++){
 			  sum+=a[i][j];
 			}
 			k++;
 			b[k] = sum;
 		}

 		c = b[1];

 		sort (b, b+k+1);

 		for (i = k; i >= 1; i--){

 		x++;
 		if (b[i] == c){

 			pos = x;
 			break;
 		 }

 		}

 		cout << pos << endl;

	return 0;
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            Console.WriteLine(solve(str));
            Console.ReadLine();
        }
        static string solve(string str)
        {
            while (str.Contains("  "))
            {
                str = str.Replace("  ", " ");
            }

            StringBuilder strB = new StringBuilder();
            for (int i = 0; i < str.Length; i++)
            {
                bool punch = char.IsPunctuation(str[i]);
                bool nextPunch = i == str.Length - 1 ? false : char.IsPunctuation(str[i + 1]);
                if (punch || nextPunch)
                {
                    if (i > 0)
                        if (punch && str[i + 1] != ' ')
                        {
                            strB.Append(str[i]);
                            strB.Append(" ");
                        }
                    if (nextPunch && str[i] == ' ')
                    {

                    }
                }
                else
                    strB.Append(str[i]);

            }
            return strB.ToString();

        }

    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            Console.WriteLine(solve(str));
            Console.ReadLine();
        }
        static string solve(string str)
        {
            while (str.Contains("  "))
            {
                str = str.Replace("  ", " ");
            }

            StringBuilder strB = new StringBuilder();
            for (int i = 0; i < str.Length; i++)
            {
                bool punch = char.IsPunctuation(str[i]);
                bool nextPunch = i == str.Length - 1 ? false : char.IsPunctuation(str[i + 1]);
                if (punch || nextPunch)
                {
                    if (i > 0)
                        if (punch && str[i + 1] != ' ')
                        {
                            strB.Append(str[i]);
                            strB.Append(" ");
                        }
                        else if (nextPunch && str[i] == ' ')
                        {

                        }
                        else
                            strB.Append(str[i]);

                }
                else
                    strB.Append(str[i]);

            }
            return strB.ToString();

        }

    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            Console.WriteLine(solve(str));
            Console.ReadLine();
        }
        static string solve(string str)
        {
            while (str.Contains("  "))
            {
                str = str.Replace("  ", " ");
            }

            StringBuilder strB = new StringBuilder();
            for (int i = 0; i < str.Length; i++)
            {
                bool punch = char.IsPunctuation(str[i]);
                bool nextPunch = i == str.Length - 1 ? false : char.IsPunctuation(str[i + 1]);
                if (punch || nextPunch)
                {
                    if (i > 0)
                    {
                        if (punch && str[i + 1] != ' ')
                        {
                            strB.Append(str[i]);
                            strB.Append(" ");
                        }
                        else if (nextPunch && str[i] == ' ')
                        {

                        }
                        else
                            strB.Append(str[i]);
                    }
                    else
                    {
                        if (str[i] == ' ')
                        {

                        }
                        else
                            strB.Append(str[i]);

                    }

                }
                else
                    strB.Append(str[i]);

            }
            return strB.ToString();

        }

    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _341_Svetlana_Drozdova_Task3
{
    class Program
    {
        public static void Normalize(StringBuilder text)
        {
            for (int i = 0; i < text.Length; i++)
            {
                if (text[i]==' ' && (text[i+1]==' ' || text[i+1]=='.' || text[i+1]==',' || text[i+1]=='!' || text[i+1]=='&'))
                {
                    text.Remove(i,1);
                    i--;
                }
                if ((text[i]=='.' || text[i]==',' || text[i]=='!' || text[i]=='&') && text[i+1]!=' ')
                {
                    text.Insert(i+1, ' ');
                }

            }
        }
        static void Main(string[] args)
        {
            StringBuilder text = new StringBuilder(Console.ReadLine());
            Normalize(text);
            Console.Write(text.ToString());
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Problem1
{
    class Program
    {
        public static string ReadText()
        {
            FileStream stream = new FileStream(@"input.txt", FileMode.Open);
            StreamReader reader = new StreamReader(stream);
            string str = reader.ReadToEnd();
            stream.Close();
            return str;
        }

        public static void GenerateSentance(StringBuilder strB)
        {
            int i = 0;
            while (i < strB.Length)
            {
                if (strB[i] == ' ')
                {
                    if (strB[i + 1] == ' ')
                    {
                        strB.Remove(i, 1);
                        i--;
                    }
                }
                if (strB[i] == ',')
                {
                    if (strB[i - 1] == ' ')
                    {
                        strB.Remove(i - 1, 1);
                        i--;
                    }
                    if (strB[i + 1] != ' ')
                    {
                        strB.Insert(i + 1, ' ');
                        i++;
                    }
                }
                if (strB[i] == '.' || strB[i] == '!' || strB[i] == '?')
                {
                    if (strB[i - 1] == ' ')
                    {
                        strB.Remove(i - 1, 1);
                        i--;
                    }
                }
                i++;
            }
        }
        static void Main(string[] args)
        {
            StringBuilder strB = new StringBuilder(Console.ReadLine());
            GenerateSentance(strB);
            for (int i = 0; i < strB.Length; i++)
            {
                Console.Write("{0}", strB[i]);
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Problem1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.AppendLine(Console.ReadLine().Trim());
            for (int i = 0; i < stringBuilder.Length - 2; i++)
            {
                char currentChar = stringBuilder[i];
                char nextChar = stringBuilder[i + 1];
                if (Char.IsWhiteSpace(currentChar) && Char.IsWhiteSpace(nextChar))
                {
                    stringBuilder.Remove(i + 1, 1);
                    i--;
                }
                else if (Char.IsPunctuation(nextChar) && Char.IsWhiteSpace(currentChar))
                {
                    stringBuilder.Remove(i, 1);
                    i--;
                }
                else if (!Char.IsWhiteSpace(nextChar) && Char.IsPunctuation(currentChar))
                {
                    stringBuilder.Insert(i + 1, ' ');
                }
            }
            Console.WriteLine(stringBuilder.ToString());
        }
    }
}


/////////////////////////////////////////
//  Author : Akshay Jaggi             //
///////////////////////////////////////

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<stack>
#include<string>
#include<cstring>
#include<map>
#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define repi(i,j,N) for(int (i)=(j);(i)<(N);(i)++)
#define repg(i,j,N) for((i)=(j);(i)<(N);(i)++)
#define si(i) scanf("%d",&(i))
#define sl(i) scanf("%lld",&(i))
#define pi(i) printf("%d",(i))
#define pl(i) printf("%lld",(i))
#define pin(i) printf("%d\n",(i))
#define pln(i) printf("%lld\n",(i))
#define pw    printf(" ");
#define pn    printf("\n");

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
#define sz(a) int((a).size())
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())

int main()
{
	ios_base::sync_with_stdio(false);
	string x;
	getline(cin,x);
	int state=0;
	int i=0;
	while(i<x.length())
	{
		while(i<x.length()&&x[i]>='a'&&x[i]<='z')
		{
			cout<<x[i];
			i++;
		}
		if((x[i]=='?'||x[i]=='.'||x[i]=='!'||x[i]==','))
		{
			cout<<x[i]<<" ";
			i++;
			while(i<x.length()&&x[i]==' ')
				i++;
		}
		else if(x[i]==' ')
		{
			i++;
			while(i<x.length()&&x[i]==' ')
				i++;
			if(i<x.length()&&x[i]>='a'&&x[i]<='z')
				cout<<" ";
			else if(i<x.length())
			{
				cout<<x[i]<<" ";
				i++;
				while(i<x.length()&&x[i]==' ')
					i++;
			}
		}
	}
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

int tmp;
string s;

int main()
{
    char x[] = {',', '.', '!', '?'};
    getline(cin, s);

    int j = 0;

    while(j < s.size())
    {
        tmp = j;

        while(s[j] == ' ' && j < s.size())
            j++;

        if( j < s.size() )
            for(int i = 0; i < 4; i++)
                if(s[j] == x[i])
                    swap(s[j], s[tmp]);

        j++;
    }

    j = 0;

    while( j < s.size() )
    {
        for(int i = 0; i < 4; i++)
            if(s[j] == x[i])
            {
                cout << s[j] << " ";
                j++;

                while(s[j] == ' ' && j < s.size())
                    j++;
            }

        if(s[j] == ' ')
        {
            cout << " ";

            while(s[j] == ' ' && j < s.size())
                j++;
        }

        cout << s[j];
        j++;
    }

}


//
//  main.cpp
//  Codeforces
//
//  Created by Vishal Patel on 9/09/2014.
//  Copyright (c) 2014 Vishal Patel. All rights reserved.
//

#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <unistd.h>
#include <climits>
#include <list>
#include <string>
#include <map>
#include <set>
#include <iostream>

using namespace std;

class Panctuation147A {
public:
    string correctPanctuation(string line) {
        string s = "";
        for ( int i = 0 ; i < line.size() ;i++)
        {
            //cout << s << endl;
            if ( line[i] == '?' ||  line[i] == '!' || line[i] == ',' || line[i] == '.')
            {
                s += line[i];
                while ( line[i] == ' ' ) {
                    ++i;
                }
                if ( i != line.size() - 1)
                    s += ' ';
            }
            else if( line[i] == ' ' )
            {
                s += ' ';
                for ( int j = i + 1 ; j < line.size() ; j++ )
                {
                    if ( line[j] == '?' ||  line[j] == '!' || line[j] == ',' || line[j] == '.')
                    {

                        s.pop_back();
                        s += line[j];
                        int k = j + 1;
                        while ( line[k] == ' ' ) {
                            ++j;
                        }
                         if ( i != line.size() - 1)
                         {
                             s += ' ';
                             i++;
                         }

                    }
                    else if ( line[j] != ' ' )
                    {
                        break;
                    }
                    else if ( line[j] == ' ')
                    {
                        ++i;
                    }

                }
            }
            else{
                s+= line[i];
                //cout << s << endl;
            }
        }
        return s;
    }
};

// CUT begin
ifstream data("/Users/Shared/codeforces/codeforces/input.txt");

string next_line() {
    string s;
    getline(data, s);
    return s;
}

template <typename T> void from_stream(T &t) {
    stringstream ss(next_line());
    ss >> t;
}

void from_stream(string &s) {
    s = next_line();
}

template <typename T> void from_stream(vector<T> &ts) {
    int len;
    from_stream(len);
    ts.clear();
    for (int i = 0; i < len; ++i) {
        T t;
        from_stream(t);
        ts.push_back(t);
    }
}

template <typename T>
string to_string(T t) {
    stringstream s;
    s << t;
    return s.str();
}

string to_string(string t) {
    return "\"" + t + "\"";
}

bool double_equal(const double &a, const double &b) { return b==b && a==a && fabs(b - a) <= 1e-9 * max(1.0, fabs(a) ); }

bool do_test(string stringtocorrect,string __answer) {
    Panctuation147A *instance = new Panctuation147A();
    string __result = instance->correctPanctuation(stringtocorrect);
    delete instance;
    if (__answer == __result ) {
        cout << "PASSED!" << endl;
        return true;
    }
    else {
        cout << "FAILED!" << endl;
        cout << "           Expected: " << to_string(__answer) << endl;
        cout << "           Received: " << to_string(__result) << endl;
        return false;
    }
    return true;
}
int run_test(bool mainProcess, const set<int> &case_set, const string command) {
    int cases = 0, passed = 0;
    // skip first four lines.
    next_line();
    next_line();
    next_line();
    next_line();
    while (true) {
        if (next_line().find("input") != 0)
            break;
        //start writing here
        string stringtocorrect;
        from_stream(stringtocorrect);
        next_line();
        string __answer;
        from_stream(__answer);
        cases++;
        cout << "  Testcase #" << cases - 1 << " ... ";
        if( do_test(stringtocorrect,__answer)) {
            passed++;
        }
        //end writing here
    }
    return 0;
}

//std::string trim(std::string const& str)
//{
//    std::size_t first = str.find_first_not_of(' ');
//    std::size_t last  = str.find_last_not_of(' ');
//    return str.substr(first, last-first+1);
//}

template <typename T>
void getUserInput(T &input_var) {
    while (true)
    {

        if (std::cin >> input_var)
            break;
        else if (std::cin.eof())
            exit(EXIT_FAILURE);
    }
}

string getStringInput()
{
    string s = "";
    while (std::getline(std::cin, s, '\n')) {
        if ( s != "")
            break;
    }
    return s;
}

int main(int argc, char *argv[]) {
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(2);
    set<int> cases;
    bool mainProcess = true;
    for (int i = 1; i < argc; ++i) {
        if ( string(argv[i]) == "-") {
            mainProcess = false;
        } else {
            cases.insert(atoi(argv[i]));
        }
    }
    //cout << "Start testing" << endl << endl << endl;
    //return run_test(mainProcess, cases, argv[0]);
    //start input for on line judge
    string stringtocorrect = getStringInput();
        //calling class
    Panctuation147A *instance = new Panctuation147A() ;
    string __result = instance->correctPanctuation(stringtocorrect);
    cout << __result ;
    delete instance;
    //end input for on line judge
}


//
//  main.cpp
//  Codeforces
//
//  Created by Vishal Patel on 9/09/2014.
//  Copyright (c) 2014 Vishal Patel. All rights reserved.
//

#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <unistd.h>
#include <climits>
#include <list>
#include <string>
#include <map>
#include <set>
#include <iostream>

using namespace std;

class Panctuation147A {
public:
    string correctPanctuation(string line) {
        string s = "";
        for ( int i = 0 ; i < line.size() ;i++)
        {
            //cout << s << endl;
            if ( line[i] == '?' ||  line[i] == '!' || line[i] == ',' || line[i] == '.')
            {
                s += line[i];
                while ( line[++i] == ' ' ) {

                }
                --i;
                if ( i != line.size() - 1)
                    s += ' ';
            }
            else if( line[i] == ' ' )
            {
                s += ' ';
                for ( int j = i + 1 ; j < line.size() ; j++ )
                {
                    if ( line[j] == '?' ||  line[j] == '!' || line[j] == ',' || line[j] == '.')
                    {

                        s.pop_back();
                        s += line[j];
                        int k = j ;
                        while ( line[k++] == ' ' ) {
                            j++;
                        }
                         if ( i != line.size() - 1)
                         {
                             s += ' ';
                             i++;
                         }

                    }
                    else if ( line[j] != ' ' )
                    {
                        break;
                    }
                    else if ( line[j] == ' ')
                    {
                        ++i;
                    }

                }
            }
            else{
                s+= line[i];
                //cout << s << endl;
            }
        }
        return s;
    }
};

// CUT begin
ifstream data("/Users/Shared/codeforces/codeforces/input.txt");

string next_line() {
    string s;
    getline(data, s);
    return s;
}

template <typename T> void from_stream(T &t) {
    stringstream ss(next_line());
    ss >> t;
}

void from_stream(string &s) {
    s = next_line();
}

template <typename T> void from_stream(vector<T> &ts) {
    int len;
    from_stream(len);
    ts.clear();
    for (int i = 0; i < len; ++i) {
        T t;
        from_stream(t);
        ts.push_back(t);
    }
}

template <typename T>
string to_string(T t) {
    stringstream s;
    s << t;
    return s.str();
}

string to_string(string t) {
    return "\"" + t + "\"";
}

bool double_equal(const double &a, const double &b) { return b==b && a==a && fabs(b - a) <= 1e-9 * max(1.0, fabs(a) ); }

bool do_test(string stringtocorrect,string __answer) {
    Panctuation147A *instance = new Panctuation147A();
    string __result = instance->correctPanctuation(stringtocorrect);
    delete instance;
    if (__answer == __result ) {
        cout << "PASSED!" << endl;
        return true;
    }
    else {
        cout << "FAILED!" << endl;
        cout << "           Expected: " << to_string(__answer) << endl;
        cout << "           Received: " << to_string(__result) << endl;
        return false;
    }
    return true;
}
int run_test(bool mainProcess, const set<int> &case_set, const string command) {
    int cases = 0, passed = 0;
    // skip first four lines.
    next_line();
    next_line();
    next_line();
    next_line();
    while (true) {
        if (next_line().find("input") != 0)
            break;
        //start writing here
        string stringtocorrect;
        from_stream(stringtocorrect);
        next_line();
        string __answer;
        from_stream(__answer);
        cases++;
        cout << "  Testcase #" << cases - 1 << " ... ";
        if( do_test(stringtocorrect,__answer)) {
            passed++;
        }
        //end writing here
    }
    return 0;
}

//std::string trim(std::string const& str)
//{
//    std::size_t first = str.find_first_not_of(' ');
//    std::size_t last  = str.find_last_not_of(' ');
//    return str.substr(first, last-first+1);
//}

template <typename T>
void getUserInput(T &input_var) {
    while (true)
    {

        if (std::cin >> input_var)
            break;
        else if (std::cin.eof())
            exit(EXIT_FAILURE);
    }
}

string getStringInput()
{
    string s = "";
    while (std::getline(std::cin, s, '\n')) {
        if ( s != "")
            break;
    }
    return s;
}

int main(int argc, char *argv[]) {
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(2);
    set<int> cases;
    bool mainProcess = true;
    for (int i = 1; i < argc; ++i) {
        if ( string(argv[i]) == "-") {
            mainProcess = false;
        } else {
            cases.insert(atoi(argv[i]));
        }
    }
    //cout << "Start testing" << endl << endl << endl;
    //return run_test(mainProcess, cases, argv[0]);
    //start input for on line judge
    string stringtocorrect = getStringInput();
        //calling class
    Panctuation147A *instance = new Panctuation147A() ;
    string __result = instance->correctPanctuation(stringtocorrect);
    cout << __result ;
    delete instance;
    //end input for on line judge
}


//
//  main.cpp
//  Codeforces
//
//  Created by Vishal Patel on 9/09/2014.
//  Copyright (c) 2014 Vishal Patel. All rights reserved.
//

#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <unistd.h>
#include <climits>
#include <list>
#include <string>
#include <map>
#include <set>
#include <iostream>

using namespace std;

class Panctuation147A {
public:
    string correctPanctuation(string line) {
        string s = "";
        for ( int i = 0 ; i < line.size() ;i++)
        {
            //cout << s << endl;
            if ( line[i] == '?' ||  line[i] == '!' || line[i] == ',' || line[i] == '.')
            {
                s += line[i];
                while ( line[i] == ' ' ) {
                    ++i;
                }
                if ( i != line.size() - 1)
                    s += ' ';
            }
            else if( line[i] == ' ' )
            {
                s += ' ';
                for ( int j = i + 1 ; j < line.size() ; j++ )
                {
                    if ( line[j] == '?' ||  line[j] == '!' || line[j] == ',' || line[j] == '.')
                    {

                        s.pop_back();
                        s += line[j];
                        int k = j ;
                        while ( line[k++] == ' ' ) {
                            j++;
                        }
                         if ( i != line.size() - 1)
                         {
                             s += ' ';
                             i++;
                         }

                    }
                    else if ( line[j] != ' ' )
                    {
                        break;
                    }
                    else if ( line[j] == ' ')
                    {
                        ++i;
                    }

                }
            }
            else{
                s+= line[i];
                //cout << s << endl;
            }
        }
        return s;
    }
};

// CUT begin
ifstream data("/Users/Shared/codeforces/codeforces/input.txt");

string next_line() {
    string s;
    getline(data, s);
    return s;
}

template <typename T> void from_stream(T &t) {
    stringstream ss(next_line());
    ss >> t;
}

void from_stream(string &s) {
    s = next_line();
}

template <typename T> void from_stream(vector<T> &ts) {
    int len;
    from_stream(len);
    ts.clear();
    for (int i = 0; i < len; ++i) {
        T t;
        from_stream(t);
        ts.push_back(t);
    }
}

template <typename T>
string to_string(T t) {
    stringstream s;
    s << t;
    return s.str();
}

string to_string(string t) {
    return "\"" + t + "\"";
}

bool double_equal(const double &a, const double &b) { return b==b && a==a && fabs(b - a) <= 1e-9 * max(1.0, fabs(a) ); }

bool do_test(string stringtocorrect,string __answer) {
    Panctuation147A *instance = new Panctuation147A();
    string __result = instance->correctPanctuation(stringtocorrect);
    delete instance;
    if (__answer == __result ) {
        cout << "PASSED!" << endl;
        return true;
    }
    else {
        cout << "FAILED!" << endl;
        cout << "           Expected: " << to_string(__answer) << endl;
        cout << "           Received: " << to_string(__result) << endl;
        return false;
    }
    return true;
}
int run_test(bool mainProcess, const set<int> &case_set, const string command) {
    int cases = 0, passed = 0;
    // skip first four lines.
    next_line();
    next_line();
    next_line();
    next_line();
    while (true) {
        if (next_line().find("input") != 0)
            break;
        //start writing here
        string stringtocorrect;
        from_stream(stringtocorrect);
        next_line();
        string __answer;
        from_stream(__answer);
        cases++;
        cout << "  Testcase #" << cases - 1 << " ... ";
        if( do_test(stringtocorrect,__answer)) {
            passed++;
        }
        //end writing here
    }
    return 0;
}

//std::string trim(std::string const& str)
//{
//    std::size_t first = str.find_first_not_of(' ');
//    std::size_t last  = str.find_last_not_of(' ');
//    return str.substr(first, last-first+1);
//}

template <typename T>
void getUserInput(T &input_var) {
    while (true)
    {

        if (std::cin >> input_var)
            break;
        else if (std::cin.eof())
            exit(EXIT_FAILURE);
    }
}

string getStringInput()
{
    string s = "";
    while (std::getline(std::cin, s, '\n')) {
        if ( s != "")
            break;
    }
    return s;
}

int main(int argc, char *argv[]) {
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(2);
    set<int> cases;
    bool mainProcess = true;
    for (int i = 1; i < argc; ++i) {
        if ( string(argv[i]) == "-") {
            mainProcess = false;
        } else {
            cases.insert(atoi(argv[i]));
        }
    }
    //cout << "Start testing" << endl << endl << endl;
    //return run_test(mainProcess, cases, argv[0]);
    //start input for on line judge
    string stringtocorrect = getStringInput();
        //calling class
    Panctuation147A *instance = new Panctuation147A() ;
    string __result = instance->correctPanctuation(stringtocorrect);
    cout << __result ;
    delete instance;
    //end input for on line judge
}


//
//  main.cpp
//  Codeforces
//
//  Created by Vishal Patel on 9/09/2014.
//  Copyright (c) 2014 Vishal Patel. All rights reserved.
//

#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <typeinfo>
#include <fstream>
#include <unistd.h>
#include <climits>
#include <list>
#include <string>
#include <map>
#include <set>
#include <iostream>

using namespace std;

class Panctuation147A {
public:
    string correctPanctuation(string line) {
        string s = "";
        for ( int i = 0 ; i < line.size() ;i++)
        {
            //cout << s << endl;
            if ( line[i] == '?' ||  line[i] == '!' || line[i] == ',' || line[i] == '.')
            {
                s += line[i];
                while ( line[++i] == ' ' ) {

                }
                --i;
                if ( i != line.size() - 1)
                    s += ' ';
            }
            else if( line[i] == ' ' )
            {
                s += ' ';
                for ( int j = i + 1 ; j < line.size() ; j++ )
                {
                    if ( line[j] == '?' ||  line[j] == '!' || line[j] == ',' || line[j] == '.')
                    {

                        s.pop_back();
                        s += line[j];
                        int k = j ;
                        while ( line[k++] == ' ' ) {
                            j++;
                        }
                         if ( i != line.size() - 1)
                         {
                             s += ' ';
                             i++;
                         }

                    }
                    else if ( line[j] != ' ' )
                    {
                        break;
                    }
                    else if ( line[j] == ' ')
                    {
                        ++i;
                    }

                }
            }
            else{
                s+= line[i];
                //cout << s << endl;
            }
        }
        return s;
    }
};

// CUT begin
ifstream data("/Users/Shared/codeforces/codeforces/input.txt");

string next_line() {
    string s;
    getline(data, s);
    return s;
}

template <typename T> void from_stream(T &t) {
    stringstream ss(next_line());
    ss >> t;
}

void from_stream(string &s) {
    s = next_line();
}

template <typename T> void from_stream(vector<T> &ts) {
    int len;
    from_stream(len);
    ts.clear();
    for (int i = 0; i < len; ++i) {
        T t;
        from_stream(t);
        ts.push_back(t);
    }
}

template <typename T>
string to_string(T t) {
    stringstream s;
    s << t;
    return s.str();
}

string to_string(string t) {
    return "\"" + t + "\"";
}

bool double_equal(const double &a, const double &b) { return b==b && a==a && fabs(b - a) <= 1e-9 * max(1.0, fabs(a) ); }

bool do_test(string stringtocorrect,string __answer) {
    Panctuation147A *instance = new Panctuation147A();
    string __result = instance->correctPanctuation(stringtocorrect);
    delete instance;
    if (__answer == __result ) {
        cout << "PASSED!" << endl;
        return true;
    }
    else {
        cout << "FAILED!" << endl;
        cout << "           Expected: " << to_string(__answer) << endl;
        cout << "           Received: " << to_string(__result) << endl;
        return false;
    }
    return true;
}
int run_test(bool mainProcess, const set<int> &case_set, const string command) {
    int cases = 0, passed = 0;
    // skip first four lines.
    next_line();
    next_line();
    next_line();
    next_line();
    while (true) {
        if (next_line().find("input") != 0)
            break;
        //start writing here
        string stringtocorrect;
        from_stream(stringtocorrect);
        next_line();
        string __answer;
        from_stream(__answer);
        cases++;
        cout << "  Testcase #" << cases - 1 << " ... ";
        if( do_test(stringtocorrect,__answer)) {
            passed++;
        }
        //end writing here
    }
    return 0;
}

//std::string trim(std::string const& str)
//{
//    std::size_t first = str.find_first_not_of(' ');
//    std::size_t last  = str.find_last_not_of(' ');
//    return str.substr(first, last-first+1);
//}

template <typename T>
void getUserInput(T &input_var) {
    while (true)
    {

        if (std::cin >> input_var)
            break;
        else if (std::cin.eof())
            exit(EXIT_FAILURE);
    }
}

string getStringInput()
{
    string s = "";
    while (std::getline(std::cin, s, '\n')) {
        if ( s != "")
            break;
    }
    return s;
}

int main(int argc, char *argv[]) {
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(2);
    set<int> cases;
    bool mainProcess = true;
    for (int i = 1; i < argc; ++i) {
        if ( string(argv[i]) == "-") {
            mainProcess = false;
        } else {
            cases.insert(atoi(argv[i]));
        }
    }
    cout << "Start testing" << endl << endl << endl;
    return run_test(mainProcess, cases, argv[0]);
    //start input for on line judge
    string stringtocorrect = getStringInput();
        //calling class
    Panctuation147A *instance = new Panctuation147A() ;
    string __result = instance->correctPanctuation(stringtocorrect);
    cout << __result ;
    delete instance;
    //end input for on line judge
}


//ITNOG
#include<bits/stdc++.h>

using namespace std;
#define int long long
const int maxN = 100*1000 + 5;

main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    string s; getline(cin, s);
    vector<string> v;
    string tmp;
    for(int i = 0; i < s.size(); i ++)
    {
	  if(s[i] == ' ')
	  {
		if(tmp.size()) v.push_back(tmp), tmp = "";
		continue;
	  }
	  if(s[i] == '.' || s[i] == ',' || s[i] == '!' || s[i] == '?')
	  {
		tmp += s[i]; v.push_back(tmp); tmp = "";
		continue;
	  }
	  tmp += s[i];
    }
    if(tmp.size()) v.push_back(tmp);
    for(int i = 0; i < v.size(); i ++)
    {
	  if(v[i] == "." || v[i] == "," || v[i] == "!" || v[i] == "?")
		v[i - 1] += v[i], v[i] = "";
    }
    for(int i = 0; i < v.size(); i ++)
	  if(v[i].size()) cout << v[i] << ' ';
    cout << endl;
    return 0;
}
//End


//ITNOG
#include<bits/stdc++.h>

using namespace std;
#define int long long
const int maxN = 100*1000 + 5;

main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    string s; getline(cin, s);
    vector<string> v;
    string tmp;
    for(int i = 0; i < s.size(); i ++)
    {
	  if(s[i] == ' ')
	  {
		if(tmp.size()) v.push_back(tmp), tmp = "";
		continue;
	  }
	  if(s[i] == '.' || s[i] == ',' || s[i] == '!' || s[i] == '?')
	  {
		tmp += s[i]; v.push_back(tmp); tmp = "";
		continue;
	  }
	  tmp += s[i];
    }
    if(tmp.size()) v.push_back(tmp);
    for(int i = 0; i < v.size(); i ++)
    {
	  if(v[i] == "." || v[i] == "," || v[i] == "!" || v[i] == "?")
		v[i - 1] += v[i], v[i] = "";
    }
    for(int i = 0; i < v.size(); i ++)
    {
	  if(i && v[i].size()) cout << ' ';
	  if(v[i].size()) cout << v[i];
    }
    cout << endl;
    return 0;
}
//End


//ITNOG
#include<bits/stdc++.h>

using namespace std;
#define int long long
const int maxN = 100*1000 + 5;

main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    string s; getline(cin, s);
    vector<string> v;
    string tmp;
    for(int i = 0; i < s.size(); i ++)
    {
	  if(s[i] == ' ')
	  {
		if(tmp.size()) v.push_back(tmp), tmp = "";
		continue;
	  }
	  if(s[i] == '.' || s[i] == ',' || s[i] == '!' || s[i] == '?')
	  {
		tmp += s[i]; v.push_back(tmp); tmp = "";
		continue;
	  }
	  tmp += s[i];
    }
    if(tmp.size()) v.push_back(tmp);
    for(int i = 0; i < v.size(); i ++)
    {
	  if(v[i] == "." || v[i] == "," || v[i] == "!" || v[i] == "?")
		v[i - 1] += v[i], v[i] = "";
    }
    for(int i = 0; i < v.size(); i ++)
    {
	  if(i) cout << ' ';
	  if(v[i].size()) cout << v[i];
    }
    cout << endl;
    return 0;
}
//End


#include <stdio.h>
#include <string>
#include <ctype.h>
#include <iostream>
using namespace std;
int main() {
  string s, res;
  bool flag = false;
  getline(cin, s);
  for (int i = 0; i < s.size(); i++) {
    if (isspace(s[i])) {
      flag = true;
      continue;
    }
    if (isalpha(s[i])) {
      if (flag)
        res += " ";
      flag = false;
      res.append(1, s[i]);
    }
    if (ispunct(s[i])) {
      res.append(1, s[i]);
      flag = true;
    }
  }
  cout << res << endl;
  return 0;
}


#include <stdio.h>
#include <string>
#include <ctype.h>
#include <iostream>
using namespace std;
int main() {
  string s, res;
  bool flag = false;
  getline(cin, s);
  for (int i = 0; i < s.size(); i++) {
    if (isspace(s[i])) {
      flag = true;
      continue;
    }
    if (isalpha(s[i])) {
      if (flag)
        res += " ";
      flag = false;
      res.append(1, s[i]);
    }
    if (ispunct(s[i])) {
      res.append(1, s[i]);
      res += " ";
      flag = false;
    }
  }
  cout << res << endl;
  return 0;
}


#include <stdio.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <sstream>

#define pb push_back
#define mp make_pair
#define PI 3.14159265358979
#define forn(i, n) for(int i = 0; i < n; ++i)
#define ALL(x) x.begin(), x.end()
#define L(s) (int)((s).size())
#define ms(x) memset(x,0,sizeof(x));

typedef long long ll;
using namespace std;
typedef pair<int,int> pii;
const int INF = 2147483647;
const ll LLINF = 9223372036854775807LL;

char a[10010];

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	gets(a);
	string ans = "";
	for(int i = 0;a[i]!='\0';i++)
	{
		if(a[i]==',' || a[i] == ' ' || a[i] == '?' || a[i] == '!')
		{
			int s = i;
			bool z = false;
			char s = '0';
			while(a[i]==' ' || a[i] == ',' || a[i] == '?' || a[i] == '!')
			{
				if((a[i] == ',' || a[i] == '?' || a[i] == '!' ) && s == '0')
				{
					z = true;
					s = a[i];
				}
				i++;
			}
			if(z)
				ans+=s;
			ans+=' ';
		}
		ans+=a[i];
	}
	cout << ans;
}


#include <stdio.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <sstream>

#define pb push_back
#define mp make_pair
#define PI 3.14159265358979
#define forn(i, n) for(int i = 0; i < n; ++i)
#define ALL(x) x.begin(), x.end()
#define L(s) (int)((s).size())
#define ms(x) memset(x,0,sizeof(x));

typedef long long ll;
using namespace std;
typedef pair<int,int> pii;
const int INF = 2147483647;
const ll LLINF = 9223372036854775807LL;

char a[10010];

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	gets(a);
	string ans = "";
	for(int i = 0;a[i]!='\0';i++)
	{
		if(a[i]==',' || a[i] == ' ' || a[i] == '?' || a[i] == '!')
		{
			bool z = false;
			char e = '0';
			while(a[i]==' ' || a[i] == ',' || a[i] == '?' || a[i] == '!')
			{
				if((a[i] == ',' || a[i] == '?' || a[i] == '!' ) && e == '0')
				{
					z = true;
					e = a[i];
				}
				i++;
			}
			if(z)
				ans+=e;
			if(a[i]!='\0');
				ans+=' ';
		}
		ans+=a[i];
	}
	cout << ans;
}


#include <stdio.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <sstream>

#define pb push_back
#define mp make_pair
#define PI 3.14159265358979
#define forn(i, n) for(int i = 0; i < n; ++i)
#define ALL(x) x.begin(), x.end()
#define L(s) (int)((s).size())
#define ms(x) memset(x,0,sizeof(x));

typedef long long ll;
using namespace std;
typedef pair<int,int> pii;
const int INF = 2147483647;
const ll LLINF = 9223372036854775807LL;

char a[10010];

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	gets(a);
	string ans = "";
	for(int i = 0;a[i]!='\0';i++)
	{
		if(a[i]==',' || a[i] == ' ')
		{
			int s = i;
			bool z = false;
			while(a[i]==' ' || a[i] == ',')
			{
				if(a[i] == ',')
					z = true;
				i++;
			}
			if(z)
			{
				ans+=", ";
			}
			else
				ans+=' ';
		}
		ans+=a[i];
	}
	cout << ans;
}


#include <stdio.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <sstream>

#define pb push_back
#define mp make_pair
#define PI 3.14159265358979
#define forn(i, n) for(int i = 0; i < n; ++i)
#define ALL(x) x.begin(), x.end()
#define L(s) (int)((s).size())
#define ms(x) memset(x,0,sizeof(x));

typedef long long ll;
using namespace std;
typedef pair<int,int> pii;
const int INF = 2147483647;
const ll LLINF = 9223372036854775807LL;

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}


#include <stdio.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <sstream>

#define pb push_back
#define mp make_pair
#define PI 3.14159265358979
#define forn(i, n) for(int i = 0; i < n; ++i)
#define ALL(x) x.begin(), x.end()
#define L(s) (int)((s).size())
#define ms(x) memset(x,0,sizeof(x));

typedef long long ll;
using namespace std;
typedef pair<int,int> pii;
const int INF = 2147483647;
const ll LLINF = 9223372036854775807LL;

char a[10010];

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
	gets(a);
	string ans = "";
	for(int i = 0;a[i]!='\0';i++)
	{
		if(a[i]==',' || a[i] == ' ' || a[i] == '?' || a[i] == '!' || a[i] == '.')
		{
			bool z = false;
			char e = '0';
			while(a[i]==' ' || a[i] == ',' || a[i] == '?' || a[i] == '!' || a[i] == '.')
			{
				if((a[i] == ',' || a[i] == '?' || a[i] == '!' || a[i] == '.') && e == '0')
				{
					z = true;
					e = a[i];
				}
				i++;
			}
			if(z)
				ans+=e;
			if(a[i]!='\0');
				ans+=' ';
		}
		ans+=a[i];
	}
	cout << ans;
}


#include <algorithm>
#include <cstdio>
#include <vector>
#include <set>
using namespace std;
char buf[100000];
char buf2[100000];

int main(){
  #ifdef twentyone
  freopen("A.in","r",stdin);
  #endif

  gets(buf);
  int space=0;
  for (int i=0,j=0; buf[i]; i++){
    if (buf[i]!=' '){
      if (buf[i]=='?' or buf[i]=='.' or buf[i]==',' or buf[i]=='!'){
        if (space>1) buf2[j++]=' ';
        buf2[j++]=buf[i];
        space=2;
      }else{
        if (space>0) buf2[j++]=' ';
        buf2[j++]=buf[i];
        space=0;
      }
    }else
      space=1;
  }
  printf("%s\n",buf2);
}


#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <list>

using namespace std;

typedef long long ll;

typedef vector<ll>vi;
typedef pair<ll,ll>ii;
typedef vector<ii>vii;

#define INF 0x3F3F3F3F
#define ler(x) scanf("%lld",&x);
#define imp(x) printf("%lld",x);
#define REP(n) for(ll i=0;i<n;++i)
#define PI 2*acos(0.0)
#define MAXN 100100

//g++ -std=c++11

int main()
{
    string s;
    getline(cin,s);
    string novo="";
    int j = -1;
    for(int i=0;i<s.size();++i)
    {
        if(s[i]==' ')
        {
            if(novo!="")
            {
                if(novo[j]!=' ')
                {
                    novo.push_back(s[i]);
                    j++;
                }
            }

        }
        else
        {
            novo.push_back(s[i]);
            j++;
        }
    }
    s = novo;
    //cout << s << endl;
    for(int i=0;i<s.size()-1;++i)
    {
        if(s[i]>='a' && s[i]<='z' || s[i]>='A' && s[i]<='Z')
        {
            cout << s[i];
        }
        else if(s[i]==' ')
        {
            if(s[i+1]==',' || s[i+1]=='!' || s[i+1]=='.' || s[i+1]=='?')
            {
                swap(s[i],s[i+1]);
            }
            cout << s[i];
        }
        else cout << s[i] << " ";
    }
    if(s[s.size()-1]!=' ')cout << s[s.size()-1];
    cout << endl;
    return 0;
}


#include <iomanip>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <list>

using namespace std;

typedef long long ll;

typedef vector<ll>vi;
typedef pair<ll,ll>ii;
typedef vector<ii>vii;

#define INF 0x3F3F3F3F
#define ler(x) scanf("%lld",&x);
#define imp(x) printf("%lld",x);
#define REP(n) for(ll i=0;i<n;++i)
#define PI 2*acos(0.0)
#define MAXN 100100

//g++ -std=c++11

int main()
{
	string s;
	getline(cin,s);
	string novo="";
	int j = -1;
	for(int i=0;i<s.size();++i)
	{
		if(s[i]==' ')
		{
			if(novo!="")
			{
				if(novo[j]!=' ')
				{
					novo.push_back(s[i]);
					j++;
				}
			}

		}
		else
		{
			novo.push_back(s[i]);
			j++;
		}
	}
	s = novo;
	novo = "";

	for(int i=0;i<s.size()-1;++i)
	{
		if(s[i]>='a' && s[i]<='z' || s[i]>='A' && s[i]<='Z')
		{
			novo.push_back(s[i]);
		}
		else if(s[i]==' ')
		{
			if(s[i+1]==',' || s[i+1]=='!' || s[i+1]=='.' || s[i+1]=='?')
			{
				swap(s[i],s[i+1]);
			}
			novo.push_back(s[i]);
		}
		else if(s[i+1]==' ') novo.push_back(s[i]);
		else
		{
			novo.push_back(s[i]);
			novo.push_back(' ');
		}
	}
	if(s[s.size()-1]!=' ')novo.push_back(s[s.size()-1]);

	s = novo;
	novo = "";

	j = -1;
	for(int i=0;i<s.size();++i)
	{
		if(s[i]==' ')
		{
			if(novo!="")
			{
				if(novo[j]!=' ')
				{
					novo.push_back(s[i]);
					j++;
				}
			}

		}
		else
		{
			novo.push_back(s[i]);
			j++;
		}
	}
	cout << novo << endl;
	return 0;
}