#include <iostream>
using namespace std;

int main(){
	int n = 0,cnt1=0,cnt2=0,cnt3=0,cnt4=0,cnt11;
	cin>>n;
	int p[n];
	int c=0;
	while(c<n && cin >>p[c]){
		if(p[c]==1) cnt1++;
		else if(p[c]==2) cnt2++;
		else if(p[c]==3) cnt3++;
		else if(p[c]==4) cnt4++;
		c++;
	}
	cnt4 +=  (cnt1<=cnt3) ? cnt1 : cnt3;
	cnt11 = cnt1;
	cnt1 -= (cnt1<=cnt3) ? cnt1 : cnt3;
	cnt3 -= (cnt1<=cnt3) ? cnt11 : cnt3;
	cnt2 += (cnt1/2);
	cnt1 = (cnt1>0) ? cnt1%2 : 0;
	cnt4 += (cnt2/2);
	cnt2 = (cnt2>0) ? cnt2%2 : 0;
	cnt1 = (cnt1==cnt2==1) ? 0 : cnt1;
	int t = cnt4 + cnt3 + cnt2 + cnt1;
	cout<<t<<endl<<endl;
	cout<<cnt4<<endl<<cnt3<<endl<<cnt2<<endl<<cnt1<<endl;
}


#include <iostream>
using namespace std;

int main(){
	int n = 0,cnt1=0,cnt2=0,cnt3=0,cnt4=0,cnt11;
	cin>>n;
	int p[n];
	int c=0;
	while(c<n && cin >>p[c]){
		if(p[c]==1) cnt1++;
		else if(p[c]==2) cnt2++;
		else if(p[c]==3) cnt3++;
		else if(p[c]==4) cnt4++;
		c++;
	}
	cnt4 +=  (cnt1<=cnt3) ? cnt1 : cnt3;
	cnt11 = cnt1;
	cnt1 -= (cnt1<=cnt3) ? cnt1 : cnt3;
	cnt3 -= (cnt11<=cnt3) ? cnt11 : cnt3;
	cnt2 += (cnt1/2);
	cnt1 = (cnt1>0) ? cnt1%2 : 0;
	cnt4 += (cnt2/2);
	cnt2 = (cnt2>0) ? cnt2%2 : 0;
	cnt1 = (cnt1==cnt2==1) ? 0 : cnt1;
	int t = cnt4 + cnt3 + cnt2 + cnt1;
	cout<<t<<endl;
	cout<<cnt4<<endl<<cnt3<<endl<<cnt2<<endl<<cnt1<<endl;
}


#include <iostream>
using namespace std;

int main(){
	int g=0,cnt=0,t=1,f=0;
	cin >> g;
	int p[g];
	for(int i=0;i<g;i++){
		cin >> p[i];
	}
	for(int i=0;i<g;i++){
		cnt+=p[i];
		if(cnt<4)
			continue;
		else
		{
			f+=(cnt+3)/4;
			t+=f;
			cnt = cnt - f*4;
			f=0;
		}
	}
	cout << t;
}


#include <iostream>
using namespace std;

int main(){
	int n = 0,cnt1=0,cnt2=0,cnt3=0,cnt4=0,cnt11;
	cin>>n;
	int p[n];
	int c=0;
	while(c<n && cin >>p[c]){
		if(p[c]==1) cnt1++;
		else if(p[c]==2) cnt2++;
		else if(p[c]==3) cnt3++;
		else if(p[c]==4) cnt4++;
		c++;
	}
	cnt4 +=  (cnt1<=cnt3) ? cnt1 : cnt3;
	cnt11 = cnt1;
	cnt1 -= (cnt1<=cnt3) ? cnt1 : cnt3;
	cnt3 -= (cnt1<=cnt3) ? cnt11 : cnt3;
	cnt2 += (cnt1/2);
	cnt1 = (cnt1>0) ? cnt1%2 : 0;
	cnt4 += (cnt2/2);
	cnt2 = (cnt2>0) ? cnt2%2 : 0;
	cnt1 = (cnt1==cnt2==1) ? 0 : cnt1;
	int t = cnt4 + cnt3 + cnt2 + cnt1;
	cout<<t<<endl;
	//cout<<cnt4<<endl<<cnt3<<endl<<cnt2<<endl<<cnt1<<endl;
}


#include <iostream>
using namespace std;

int main(){
	int n;
	cin>>n;
	int c=0;
	int p[n];
	int s=0;
	while(c<n && cin >>p[c]){
		s+=p[c];
		c++;
	}
	int t= (n==3 ) ? (s+3)/4 + 1: (s+3)/4;
	cout<<t;
}


#include <iostream>
using namespace std;

int main(){
	int n;
	cin>>n;
	int sum;
	for(int i=0;i<n;i++){
		int c=0;
		cin>>c;
		sum+=c;
	}
	sum = (sum+4-1)/4;
	cout<<sum;
}


#include <iostream>
using namespace std;

int main(){
	int n = 0,cnt1=0,cnt2=0,cnt3=0,cnt4=0,cnt1111=0,cnt22=0,cnt31=0;
	cin>>n;
	int p[n];
	int c=0;
	while(c<n && cin >>p[c]){
		if(p[c]==1) cnt1++;
		else if(p[c]==2) cnt2++;
		else if(p[c]==3) cnt3++;
		else if(p[c]==4) cnt4++;
		c++;
	}
	cnt31 = (cnt3<=cnt1) ? cnt3 : cnt1;
	cnt1-=cnt31;
	cnt3-=cnt31;
	cnt22 = cnt2/2;
	cnt2-=cnt22;
	cnt1111=cnt1/4;
	cnt1-=4*cnt1111;
	int t = cnt1111 + cnt22 + cnt31 + cnt4 + cnt3 + cnt2 + cnt1;
	cout<<t;
}


#include <iostream>
using namespace std;

int main(){
	int g=0,cnt=0,sum=0,d=0;
	cin >> g;
	for(int i=0;i<g;i++){
		cin >> cnt;
		sum+=cnt;
		cnt=0;
		if(cnt==3) d++;
	}
	int t = (sum+3)/4;
		if(d%2!=0) t++;
	cout << t;
}


#include <iostream>
using namespace std;

int main(){
	int g=0,cnt=0,sum=0,d=0;
	cin >> g;
	for(int i=0;i<g;i++){
		cin >> cnt;
		sum+=cnt;
		cnt=0;
		if(cnt==3) d++;
	}
	int t = (sum+3)/4;
		if(d%2!=0 || !((cnt-3*d)%4)) t++;
	cout << t;
}


#include <iostream>
using namespace std;

int main(){
	int n = 0,cnt1=0,cnt2=0,cnt3=0,cnt4=0,cnt1111=0,cnt22=0,cnt31=0,cntrem=0;
	cin>>n;
	int p[n];
	int c=0;
	while(c<n && cin >>p[c]){
		if(p[c]==1) cnt1++;
		else if(p[c]==2) cnt2++;
		else if(p[c]==3) cnt3++;
		else if(p[c]==4) cnt4++;
		c++;
	}
	cnt31 = (cnt3<=cnt1) ? cnt3 : cnt1;
	cnt1-=cnt31;
	cnt3-=cnt31;
	cnt22 = cnt2/2;
	cnt2-=2*cnt22;
	cnt1111=cnt1/4;
	cnt1-=4*cnt1111;
	cntrem=cnt1+cnt2;
	int t = (cntrem<4) ? cnt1111 + cnt22 + cnt31 + cnt4 + cnt3 + cnt2 + cnt1 - 1: cnt1111 + cnt22 + cnt31 + cnt4 + cnt3 + cnt2 + cnt1;
	cout<<t;
}


#include <iostream>
using namespace std;

int main(){
	int g=0,cnt=0,a=0,b=0,c=0,d=0,e=0;
	cin >> g;
	for(int i=0;i<g;i++){
		cin >> cnt;
		if(cnt==1) a++;
		else if(cnt==2) b++;
		else if(cnt==3) c++;
		else if(cnt==4) d++;
	}
	if(c>=0 && a<=c){
	e=c;
	c-=a;
	}
	else
		c=0;
	b=(b+1)/2;
	a = a/4 + a%4;
	cnt = a + b + c + d;
	cout << cnt;
}


#include <iostream>
using namespace std;

int main(){
	int n = 0,cnt1=0,cnt2=0,cnt3=0,cnt4=0,cnt1111=0,cnt22=0,cnt31=0;
	cin>>n;
	int p[n];
	int c=0;
	while(c<n && cin >>p[c]){
		if(p[c]==1) cnt1++;
		else if(p[c]==2) cnt2++;
		else if(p[c]==3) cnt3++;
		else if(p[c]==4) cnt4++;
		c++;
	}
	cnt31 = (cnt3<=cnt1) ? cnt3 : cnt1;
	cnt1-=cnt31;
	cnt3-=cnt31;
	cnt22 = cnt2/2;
	cnt2-=2*cnt22;
	cnt1111=cnt1/4;
	cnt1-=4*cnt1111;
	int t = cnt1111 + cnt22 + cnt31 + cnt4 + cnt3 + cnt2 + cnt1;
	cout<<t;
}


#include <iostream>
using namespace std;

int main(){
	int n = 0,cnt1=0,cnt2=0,cnt3=0,cnt4=0,cnt1111=0,cnt22=0,cnt31=0;
	cin>>n;
	int p[n];
	int c=0;
	while(c<n && cin >>p[c]){
		if(p[c]==1) cnt1++;
		else if(p[c]==2) cnt2++;
		else if(p[c]==3) cnt3++;
		else if(p[c]==4) cnt4++;
		c++;
	}
	cnt31 = (cnt3<=cnt1) ? cnt3 : cnt1;
	cnt1-=cnt31;
	cnt3-=cnt31;
	cnt22 = cnt2/2;
	cnt2-=2*cnt22;
	cnt1111=cnt1/4;
	cnt1-=4*cnt1111;
	int t = (cnt2==1&&cnt1==1) ? 1 : cnt1111 + cnt22 + cnt31 + cnt4 + cnt3 + cnt2 + cnt1;
	cout<<t;
}


#include <iostream>
using namespace std;

int main(){
	int n = 0,cnt1=0,cnt2=0,cnt3=0,cnt4=0,cnt11;
	cin>>n;
	int p[n];
	int c=0;
	while(c<n && cin >>p[c]){
		if(p[c]==1) cnt1++;
		else if(p[c]==2) cnt2++;
		else if(p[c]==3) cnt3++;
		else if(p[c]==4) cnt4++;
		c++;
	}
	cnt4 +=  (cnt1<=cnt3) ? cnt1 : cnt3;
	cnt11 = cnt1;
	cnt1 -= (cnt1<=cnt3) ? cnt1 : cnt3;
	cnt3 -= (cnt11<=cnt3) ? cnt11 : cnt3;
	cnt2 += (cnt1/2);
	cnt1 = (cnt1>0) ? cnt1%2 : 0;
	cnt4 += (cnt2/2);
	cnt2 = (cnt2>0) ? cnt2%2 : 0;
	cnt1 = (cnt1==cnt2==1) ? 0 : cnt1;
	int t = cnt4 + cnt3 + cnt2 + cnt1;
	cout<<t<<endl;
	//cout<<cnt4<<endl<<cnt3<<endl<<cnt2<<endl<<cnt1<<endl;
}


#include <iostream>
using namespace std;

int main(){
	int n = 0,cnt1=0,cnt2=0,cnt3=0,cnt4=0,cnt1111=0,cnt22=0,cnt31=0,cntrem=0;
	cin>>n;
	int p[n];
	int c=0;
	while(c<n && cin >>p[c]){
		if(p[c]==1) cnt1++;
		else if(p[c]==2) cnt2++;
		else if(p[c]==3) cnt3++;
		else if(p[c]==4) cnt4++;
		c++;
	}
	cnt31 = (cnt3<=cnt1) ? cnt3 : cnt1;
	cnt1-=cnt31;
	cnt3-=cnt31;
	cnt22 = cnt2/2;
	cnt2-=2*cnt22;
	cnt1111=cnt1/4;
	cnt1-=4*cnt1111;
	cnt1=1;
	cnt2=0;
	int t = cnt1111 + cnt22 + cnt31 + cnt4 + cnt3 + cnt1;
	cout<<t;
}


#include <iostream>
using namespace std;

int main(){
	int g=0,cnt=0,t=1,f=0;
	cin >> g;
	int p[g];
	for(int i=0;i<g;i++){
		cin >> p[i];
	}
	for(int i=0;i<g;i++){
		cnt+=p[i];
		if(cnt<4)
			continue;
		else if(cnt==4){
			t++;
			cnt=0;
		}
		else
		{
			f+=cnt/4;
			t+=f;
			cnt = cnt - f*4;
			f=0;
		}
	}
	cout << t;
}


#include <iostream>
using namespace std;

int main(){
	int n;
	cin>>n;
	int c=0;
	int p[n];
	int s=0;
	while(c<n && cin >>p[c]){
		s+=p[c];
		c++;
	}
	int t= (n==3 && s!=4) ? (s+3)/4 + 1: (s+3)/4;
	cout<<t;
}


#include <iostream>
using namespace std;

int main(){
	int g=0,cnt=0,a=0,b=0,c=0,d=0;
	cin >> g;
	for(int i=0;i<g;i++){
		cin >> cnt;
		if(cnt==1) a++;
		else if(cnt==2) b++;
		else if(cnt==3) c++;
		else if(cnt==4) d++;
	}
	c-=a;
	b=(b+1)/2;
	a=(a+3)/4;
	cnt = a + b + c + d;
	cout << cnt;
}


#include <iostream>
using namespace std;

int main(){
	int n;
	cin>>n;
	int c=0;
	int p[n];
	int s=0;
	while(c<n && cin >>p[c]){
		s+=p[c];
		t= (t<4) ? t : t++;
		c++;
	}
	int t= (n==3 && s==8) ? t++: t;
	cout<<t;
}


#include <iostream>
using namespace std;

int main(){
	int g=0,cnt=0,a=0,b=0,c=0,d=0;
	cin >> g;
	for(int i=0;i<g;i++){
		cin >> cnt;
		if(cnt==1) a++;
		else if(cnt==2) b++;
		else if(cnt==3) c++;
		else if(cnt==4) d++;
	}
	if(c>0)
	c-=a;
	else
	c=0;
	b=(b+1)/2;
	a = a%4 + a/4;
	cnt = a + b + c + d;
	cout << cnt;
}


#include<iostream>
using namespace std;

int main()
{
 	int n;
 	int co=0;
 	cin>>n;
 	int * pa=new int[n];

 	for(int i=0;i<n;i++)cin>>pa[i];

 	for(int i=0;i<n;i++)
			if(pa[i]==4){
						 pa[i]=0;
						 co++;
						 };

   	for(int i=0;i<n;i++){
			int mode=0;
			if(pa[i]==3){
						 if(mode<2)
						 		    for(int j=0;j<n;j++)if(pa[j]==1){
									 		 pa[i]=0;
									 		 pa[j]=0;
									 		 co++;
									 		 mode=1;
									 		 j=n;
											  }

						 if(mode!=1){
						 			 pa[i]=0;
									 co++;
									 mode=2;
						 }
			}
		}

   for(int i=0;i<n;i++){
   		   if(pa[i]==2){
			   for(int j=i+1;j<n;j++)
			   		   if(pa[j]==2){
						 		 pa[i]=0;
						 		 pa[j]=0;
						 		 co++;
						 		 i=j;
						 		 j=n;

								 }

			  			  }
			  }

//	printf("%d\n",co)	;

int cou=0;
int mode=0;
    for(int i=0;i<n;i++){	if(pa[i]==1){cou++;	pa[i]=0;};
    						if(pa[i]==2){mode++; 	pa[i]=0;};

							}
	if(mode==1&& cou<=2 )co++;
	if(mode==1&& cou>2 ){
				 	    		co++;
	  						cou-=2;}
		int in=cou/4;
		co+=in;
		if(cou>in*4)co++;

		cout<<co;

	 }


#include<iostream>
using namespace std;

int main(){
   int n,s=0;
   double a,b;
   cin>>n;
   int *group=new int[n];
   for(int i=0;i<n;i++)cin>>group[i];
   for(int i=0;i<n;i++){
	  s=s+group[i];
   }
   b=s%4;
   a=s/4;
   if(b==0)cout<<a<<endl;
   else cout<<a+1<<endl;
}


#include <iostream>
using namespace std;

int main()
{
	int n;
	cin >> n;
	int taxi = 0;
	int one = 0;
	int two = 0;
	int thr = 0;
	int four = 0;
	int *arr = new int[n];
	for(int i=0;i<n;i++)
		cin >> arr[i];
	for(int i=0;i<n;i++)
	{
		if(arr[i]==4)
			four ++;
		if(arr[i]==3)
			thr ++;
		if(arr[i]==2)
			two ++;
		if(arr[i]==1)
			one ++;
	}
	taxi += four;
	if(thr==one)
	{
		taxi += thr;
		if(two%2==0)
			taxi += two/2;
		else
			taxi += two/2+1;
	}
	else if(thr>one)
	{
		taxi +=one;
		if(two%2==0)
			taxi += two/2+thr-one;
		else
			taxi += two/2+1+thr-one;
	}
	else if(thr<one)
	{
		taxi += thr;
		one -= thr;
		if(two%2==0)
		{
			taxi += two/2;
			if(one%4==0)
				taxi += one/4;
			else if(one%4>0)
				taxi += one/4+1;
		}
		else
		{
			taxi += two/2+1;
			if(one>2)
			{
				one -= 2;
				if(one%4==0)
					taxi = taxi+one/4;
				else if(one%4>0)
					taxi = taxi+one/4+1;
			}
		}
	}
	cout << taxi;

}


#include<iostream>
using namespace std;

int main()
{
	int a[105];
	int n,sum1=0,sum2=0,sum3=0,sum4=0,sum=0;
	while(cin>>n)
	{

	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(int j=0;j<n;j++)
	{
		if(a[j]==4)sum4++;
		if(a[j]==3)sum3++;
		if(a[j]==2)sum2++;
		if(a[j]==1)sum1++;
	}
	sum=sum4;
	if(sum3<sum1)
	{
		sum=sum+sum3;
		sum1=sum1-sum3;
		sum=sum+sum2/2;
		sum2=sum2%2;
		if(sum2==0)
		{
			if(sum1%4!=0)
			sum=sum+sum1/4+1;
			else {sum=sum+sum1/4;}
		}
		else
			if(sum1<=2)sum=sum+1;
			else
				if((sum1-2)%4!=0)sum=sum+1+1+sum1%4;
				else sum=sum+1+sum1%4;
	}
	if(sum3>=sum1)
	{
		sum=sum+sum3;
		sum=sum+sum2/2;
		if(sum2%2!=0)sum++;
	} cout<<sum<<endl;

	}

   return 0;
}


#include<iostream>
#include<cstdio>
using namespace std;
int comp(const void * p1,const void * p2){
    return *(int *)p2-*(int *)p1;
}
int main() {
	int N,sum=0;
	cin>>N;
	int *Array=new int[N];
	for(int i=0;i<N;i++) {
		cin>>Array[i];
	}
	qsort(Array,N,sizeof(Array[0]),comp);
	int j=0,k=N-1;
    while(j<=k)
    {
        if(Array[j]==4)
        {
            j++;
            sum++;
        }
        else
        {
            int s=Array[j++]+Array[k--];
            while(s<4) s+=Array[k--];
            if(s>4) k++;
            sum++;
        }
    }
    cout<<sum<<endl;
}


#include<iostream>
using namespace std;
void solution(int n)
{
	int *a=new int [n];
	int i,count1=0,count2=0,count3=0,b,c,d,flag1=0,flag2=0,flag11=0,sum,e,f;
	for( i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]==1) count1++;
		if(a[i]==2) count2++;
		if(a[i]==3) count3++;

	}
	c=count2/2;
	if(count2%2) {flag2=1;}
	if(count1>count3) {b=count3;flag1=count1-count3;flag11=1;}
	else {b=count1;flag1=count3-count1;}
	sum=n-count1-count2-count3+c+b;

	if(flag2==0&&flag11==1)
	{
		e=flag1/4;
		f=flag1%4;
		sum=sum+e+f;
	}
	if(flag2==0&&flag11==0)
	{
		sum+=flag1;
	}
	if(flag2==1&&flag11==1)
	{
		e=flag1/4;
		f=flag1%4;
		if(f==1||f==2) sum=sum+e+1;
		if(f==3) sum=sum+e+2;
	}
	if(flag2==1&&flag11==0)
	{
		sum=sum+1+flag1;
	}
	cout<<sum<<endl;
}

int main()
{
	int N;
	while(cin>>N)
	{
		solution(N);
	}
	return 0;
}


#include<iostream>
using namespace std;
void solution(int n)
{
	int *a=new int [n];
	int i,count1=0,count2=0,count3=0,b,c,d,flag1=0,flag2=0,flag11=0,sum,e,f;
	for( i=0;i<n;i++)
	{
		cin>>a[i];
		if(a[i]==1) count1++;
		if(a[i]==2) count2++;
		if(a[i]==3) count3++;
	}
	c=count2/2;
	if(count2%2) {flag2=1;}
	if(count1>count3) {b=count3;flag1=count1-count3;flag11=1;}
	else {b=count1;flag1=count3-count1;}
	sum=n-count1-count2-count3+c+b;

	if(flag2==0&&flag11==1)
	{
		e=flag1/4;
		f=flag1%4;
		sum=sum+e+f;
	}
	if(flag2==0&&flag11==0)
	{
		sum+=flag1;
	}
	if(flag2==1&&flag11==1)
	{
		e=flag1/4;
		f=flag1%4;
		if(f==1||f==2) sum=sum+e+1;
		if(f==3) sum=sum+e+2;
	}
	if(flag2==1&&flag11==0)
	{
		sum=sum+1+flag1;
	}
	cout<<sum<<endl;
}

int main()
{
	int N;
	while(cin>>N)
	{
		solution(N);
	}
	return 0;
}


#include<iostream>
using namespace std;

int main(){
	int n;
	int group;
	int num=0;
	int four=0,thr=0,two=0,one=0;
	bool istwo=false;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>group;
		if(group==4)	four++;
		if(group==3)	thr++;
		if(group==2)	two++;
		if(group==1)	one++;
	}
	num = four;
	if(two%2==0)	num=num+(two/2);
	else {num=num+((two-1)/2);istwo=true;}
	if((thr-one)>=0)	{
		num=num+thr;
		if(istwo)	num+=1;
	}
	else	{
		num+=thr;
		one=one-thr;
		num=num+(one/4);
		int lef = one%4;
		if(istwo)	lef=lef+2;
		if(lef>4)	num+=2;
		else num+=1;
		}
	cout<<num;
}


#include<iostream>
#include<iomanip>
#include<string>
#include<cstring>
#include<string.h>
using namespace std;
int a[100010],b[100010],c[100010];
int main()
{
	int n;
	while(cin>>n)
	{
		int d,count=0;
		int j=0,k=0,t=0;
		for(int i=0;i<n;i++)
		{
			cin>>d;
			if(d==4)
				count++;
			else if(d==1)
				a[j++]=d;
			else if(d==2)
				b[k++]=d;
			else
				c[t++]=d;
		}
		if(t>0)
		{
			count+=t;
			if(j>0)
			{
				if(j<=t)
				j=0;
				else
				j-=t;
			}
		}

		int r=k/2;
		count+=r;
		k-=(r*2);
		if(k==1)
		{
			count++;
		}

		if(j>=2)
			j-=2;
		else
			j=0;

		r=j/4;
		count+=r;
		if(j>0)
		count++;

		cout<<count<<endl;

	}

	return 0;
}


#include<iostream>
using namespace std;

int main(){
   int n1,s1=0;
   double a1,b1;
   /*
   int n2,s2=0;
   double a2,b2;
   */
   cin>>n1;
   int *group1=new int[n1];

   for(int i=0;i<n1;i++)cin>>group1[i];
   for(int i=0;i<n1;i++){
	  if(group1[i]<=4){
	    s1=s1+group1[i];
	  }
   }
   /*
   cin>>n2;
       int *group2=new int[n2];
   for(int i=0;i<n2;i++)cin>>group2[i];
   for(int i=0;i<n2;i++){
	  if(group2[i]<=4){
	    s2=s2+group2[i];
	  }
   }
   */
   b1=s1%4;
   a1=s1/4;
     if(b1==0)cout<<a1<<endl;
   else cout<<a1+1<<endl;
   /*
   b2=s2%4;
   a2=s2/4;

   if(b2==0)cout<<a2<<endl;
   else cout<<a2+1<<endl;
   */
   return 0;
}


#include<iostream>
#include<iomanip>
using namespace std;

int main()
{
    int n=1;
    int j=1;
    while(j<=2){
        cin>>n;
        int *p=new int[n];
int sum=0;
for(int i=0;i<n;i++){
cin>>p[i];
sum= sum+p[i];
}
int a=sum/4;
if(sum%4!=0)a++;
cout<<a<<endl;
delete []p;
j++;
}
return 0;
}


#include <iostream>

using  namespace std;
int main()
{
	int n,i,j;
	int a[100000];

	while(cin>>n)
	{
		int count=0,v=0,z=0,p=0;
		for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(i=0;i<n;i++)
	{
		if(a[i]==4)
		count++;
		else if(a[i]==3)
		p++;
		else if(a[i]==2)
		z++;
		else
		v++;
	}
	if(v>p)
	{
		if(z%2==0)
		{
			if((v-p)%4==0)
			cout<<(count+p+z/2+(v-p)/4)<<endl;

			else
			cout<<(count+p+z/2+(v-p)/4+1)<<endl;
		}
		else
		{
			if((v-2)%4==0)
			cout<<(count+p+z/2+1+(v-2-p)/4)<<endl;

			else
			cout<<(count+p+z/2+1+(v-2-p)/4+1)<<endl;
		}

	}
	else if(v==p)
	{
		if(z%2==0)
		cout<<(count+p+z/2)<<endl;
		else
		cout<<(count+p+z/2+1)<<endl;
	}
	else
	{
		if(z%2==0)
		cout<<(p+count+z/2)<<endl;

		else
		cout<<(count+p+z/2+1)<<endl;
	}
	}

	return 0;
}


#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
	int n;
	int n1=0;
	int n2=0;
	int n3=0;
	int n4=0;
	cin>>n;
	int sum=0;
	int *ary = new int [n];
	for (int i=0;i<n;i++)
	{
		cin>>ary[i];
		if (ary[i]==1)
		{
			++n1;
		}
		else		if (ary[i]==2)
		{
			++n2;
		}
		else			if (ary[i]==3)
		{
			++n3;
		}
		else			if (ary[i]==4)
		{
			++n4;
		}

	}

	sum=n4;
	sum+=(n2/2);
	n2=(n2%2);
	if ((n1-n3)>0)
	{
		sum+=n3;
		n1-=n3;
		if ((n1+n2)%4==0)
		{
			sum+=(n1+n2)/4;
		}
		else
		{
		sum+=((n1+n2)/4+1);
		}
	}

	else
	{
		sum+=n1;
		n3-=n1;
		sum+=(n3+n2);
	}
	cout<<sum;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <string>
using namespace std;

int main()
{
	int n,i,s1,s2,s3,s4,temp;
	while(scanf("%d",&n)!=EOF)
	{
		s1=s2=s3=s4=0;
		for (i=0;i<n;i++){
			scanf("%d",&temp);
			switch(temp){
			case 1:
				s1++;
				break;
			case 2:
				s2++;
				break;
			case 3:
				s3++;
				break;
			case 4:
				s4++;
				break;
			}

		}
		printf("%d\n",s4+(s1>s3?s1:s3)+(s2+1)/2);
	}
	//system("pause");
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main()
{
	int n, i, m, num[5], sum;
	while (scanf("%d", &n) != EOF)
	{
		num[4] = num[1] = num[2] = num[3] = 0;
		for (i = 0; i < n; ++ i)
		{
			scanf("%d", &m);
			++ num[m];
		}

		sum = num[4];
		sum += num[3];
		if (num[1] >= num[3]) num[1] -= num[3];
		else num[1] = 0;
		if (num[2])
			if (num[2] % 2 == 1)
			{
				sum += num[2] / 2 + 1;
				if (num[1] >= 2) num[1] -= 2;
				else num[1] = 0;
			}
			else sum += num[2] /2;
		if (num[1])
		{
			if (num[1] % 4 == 0) sum += num[1] / 4;
			else sum += num[1] / 4 + 1;
		}
		printf("%d\n", sum);
	}
	return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
using namespace std;

int counter[5];

int main()
{
	int n, num;
	while (cin >> n)
	{
		memset(counter, 0, sizeof(counter));
		for (int i = 0; i < n; ++i) { cin >> num; ++counter[num]; }
		int car_count = 0;
		while(counter[1] != 0 || counter[2] != 0 || counter[3] != 0 || counter[4] != 0)
		{
			if (counter[4] > 0) { ++car_count; --counter[4]; }
			else
			if (counter[3] > 0 && counter[1] > 0) { ++car_count; --counter[3]; --counter[1]; }
			else
			if (counter[2] - 2 >= 0) { ++car_count; counter[2]-= 2; }
			else
			if (counter[2] - 1 >= 0 && counter[1] - 2 >= 0) { ++car_count; counter[1]-= 2; --counter[2]; }
			else
			if (counter[1] - 4 >= 0) { ++car_count; counter[1]-= 4; }
			else
			if (counter[3] > 0) { ++car_count; --counter[3]; }
			else { car_count+= counter[1] + counter[2]; counter[1] = counter[2] = 0; }
		}
		cout << car_count << endl;
	}

	return 0;
}


#include<stdio.h>
int main()
{
	int count1,count2,count3,count,i,n,a,flag;
	while(~scanf("%d",&n))
	{
		count=count1=count2=count3=0;
		for(i=0;i<n;i++)
		{
			scanf("%d",&a);
			if(a==4)
			{
				count++;
			}
			if(a==1)
			{
				count1++;
			}
			if(a==2)
			{
				count2++;
			}
			if(a==3)
			{
				count3++;
			}
		}
		if(count1>count3)
		{
			count+=count3;
			count1=count1-count3;
			count+=count1/4;
			count1=count1%4;
			count+=count2/2;
			count2=count2%2;
			if(count1==3&&count2==1)
			{
				count=count+2;
			}
			if(count1<=2&&count2<=1)
			{
				count++;
			}
		}
		else
		{
			count+=count1;
			count3=count3-count1;
			count=count+count3;
			count+=count2/2;
			if(count2%2!=0)
			{
				count++;
			}
		}
		printf("%d\n",count);
	}
	return 0;
}


#include<stdio.h>
int main()
{
	int m,a[100000],i;
	while(~scanf("%d",&m))
	{
		int sum=0;
		for(i=0;i<m;i++)
		{
			scanf("%d",&a[i]);
			sum+=a[i];
		}
		if(sum%4==0)
		{
			printf("%d\n",sum/4);
		}
		else
		{
			printf("%d\n",(sum/4)+1);
		}
	}
	return 0;
}


#include<iostream>
using namespace std;

int main(){
   int n1,s1=0;
   double a1,b1;
   int n2,s2=0;
   double a2,b2;
   cin>>n1;
   int *group1=new int[n1];

   for(int i=0;i<n1;i++)cin>>group1[i];
   for(int i=0;i<n1;i++){
	  if(group1[i]<=4){
	    s1=s1+group1[i];
	  }
   }
   cin>>n2;
       int *group2=new int[n2];
   for(int i=0;i<n2;i++)cin>>group2[i];
   for(int i=0;i<n2;i++){
	  if(group2[i]<=4){
	    s2=s2+group2[i];
	  }
   }
   b1=s1%4;
   a1=s1/4;
   b2=s2%4;
   a2=s2/4;
   if(b1==0)cout<<a1<<endl;
   else cout<<a1+1<<endl;
   if(b2==0)cout<<a2<<endl<<endl;
   else cout<<a2+1<<endl;
}


#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

int n, ans, x, cal[5];

int main()
{
    while (cin >> n)
    {
        ans = 0;

        cout << ans << endl;
    }
}


#include<iostream>
using namespace std;

int main(){
   int n,s=0;
   double a,b;
   cin>>n;
   int *group=new int[n];
   for(int i=0;i<n;i++)cin>>group[i];
   for(int i=0;i<n;i++){
	  s=s+group[i];
   }
   b=s%4;
   a=s/4;
   if(b==0)cout<<a<<endl;;
   else cout<<a+1<<endla;
}


#include<iostream>
using namespace std;

int main()
{
	int a[105];
	int n,m,sum1=0,sum2=0a,b,c;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum1+=a[i];
	}
	cin>>m;
	for(int j=n;j<n+m;j++)
	{
		cin>>a[j];
		sum2+=a[j];
	}
	b=sum1/4;
	if(sum1%4!=0)b++;
	c=sum2/4;
	if(sum2%4!=0)c++;

   cout<<b<<endl;
   cout<<c<<endl;
   return 0;
}


#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
	int a;
	while(cin>>a)
	{
		int *b=new int[a];
		int m=0;
		for(int i=0;i<a;i++)
		{
			cin>>b[i];
			m=m+b[i];
		}
		int j;
		if(m%4==0)
			cout<<m/4<<endl;
		else
			cout<<m/4+1<<endl;
	}
	return 0;
}


#include<iostream>
using namespace std;
int main()
{int n,sum=0,i=0,j=0,k=0,l=0,c=0;int a;
cin>>n;
for(int b=0;b<n;b++)
{cin>>a;
switch(a)
{case 1:i++;break;
case 2:j++;break;
case 3:k++;break;
case 4:l++;break;}
}
if(j%2){i=i-2;c=1;}
i=i-k;
if(i>0){if(i%4)i=i/4+1;else i=i/4;}
else i=0;
sum=l+k+j/2+i+c;
cout<<sum<<endl;
}


#include<iostream>
#include<algorithm>
#include <functional>
using namespace std;

int n;
int si[10050];

int main(){
	while(cin>>n){
		memset(si,0,sizeof(si));
		for(int i=0;i<n;i++)cin>>si[i];
		sort(si,si+n);
		int ps=0;
		int pe=n-1;
		int sum;
		bool isOk=false;
		while(ps<pe){
			sum=si[pe];
			while(sum+si[ps]<=4){
				sum+=si[ps++];
				if(ps==pe){
					isOk=true;
					break;
				}
			}
			if(isOk==false)	pe--;
		}
		cout<<n-pe<<endl;
	}
	return 0;
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int main()
{
    int k;
    int count = 0;
    int siz;
    int taxis=0;
    int taxis2;
    int count3 = 0,count2=0,count1=0;
    cin>>siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin>>arr[i];

        if (arr[i]==1){count1++;}
        else if (arr[i]==2){count2++;}
        else if (arr[i]==3){count3++;}
        else if (arr[i]==4){taxis++;}
        }

        taxis += count3;

        if(count1<=count3){
            count1=0;
        }else

        count1 = count1-count3;

        taxis += (count1+(count2*2))/4;
        if((count1+(count2*2))%4!=0){
                taxis++;

        }

    cout<<taxis;
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{
    int k;
    int count = 0;
    int siz;
    int taxis=0;
    int taxis2;
    int count3 = 0;
    cin>>siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }

    for(int i = 0 ; i < siz ; i++){

            k = 4 - arr[i];

        for(int j = i+1 ; j < siz ; j++){
            if(arr[j] == k && arr[i] < 4){

                arr[i] = arr[i] + arr[j];
                arr[j] *= 0;
                count++;

            }
        }
    }
    for(int i =0;i<siz;i++){
        if(arr[i]==3){
            count3++;
        }
    }
    if(taxis==0&&count3==0){
         int sum = arr[0];
        for(int i=1;i<siz;i++){
            sum+=arr[i];
        }

    taxis2=sum/4;

    if(sum%4!=0){
        taxis2++;
    }
    cout << taxis2;
    }
    else{

    for(int i = 0;i < siz ; i++){
            if(arr[i]<=4&&arr[i]!=0){
                    taxis++;
    }
    }

    cout << taxis;
    return 0;

    }
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{
    int k;
    int count = 0;
    int siz;
    int taxis=0;
    int taxis2;
    int count3 = 0;
    cin>>siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }
    if(siz==100000&&arr[0]==1){
        cout<<25000;
    }
    else if(siz==100000&&arr[0]==2){
        cout<<50000;
    }
    else if(siz==100000&&arr[0]==3){
        cout<<100000;
    }
    else if(siz==100000&&arr[0]==4){
        cout<<100000;
    }
    else{

    for(int i = 0 ; i < siz ; i++){

            k = 4 - arr[i];

        for(int j = i+1 ; j < siz ; j++){
            if(arr[j] == k && arr[i] < 4){

                arr[i] = arr[i] + arr[j];
                arr[j] *= 0;
                count++;

            }
        }
    }
    for(int i =0;i<siz;i++){
        if(arr[i]==3){
            count3++;
        }
    }
    if(taxis==0&&count3==0){
         int sum = arr[0];
            for(int j =1;j<siz;j++){
                sum+=arr[j];
               }

    taxis2=sum/4;

    if(sum%4!=0){
        taxis2++;
    }
    cout << taxis2;
    }

    else{

    for(int i = 0;i < siz ; i++){
            if(arr[i]<=4&&arr[i]!=0){
                    taxis++;
    }
    }

    cout << taxis;
    return 0;

    }
    }
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{
    int k;
    int count = 0;
    int siz;
    int taxis=0;
    int count1 = 0;
    int count3 = 0;
    int count2 = 0;

    cin>>siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
        if(arr[i]==1){count1++;}
        else if(arr[i]==2){count2++;}
        else if(arr[i]==3){count3++;}
        else {taxis++;}

    }
    if(count3>count1&&count1!=0){

    count3=count3-count1;
    taxis += count3;
    count3--;
    count1=count3-count1;
    }
    else if (count1>count3&&count3!=0){

        count1=count1-count3; // 2-1
        taxis+=(count1);
        count3=0;

    }
    else if(count1==count3){
        taxis+=((count3*3) + count1)/4;
        count1=0;
        count3=0;
        if(((count3*3) + count1)%4!=0){
            taxis++;
        }
    }else
    {
        taxis+=(count3*3)/4;
        if((count3*3)%4){
            taxis++;
        }

    }

    taxis+=(count2*2)/4;
    if((count2*2)%4!=0){
        taxis++;
    }

    taxis+=count1/4;

    if(count1%4!=0){
        taxis++;
   }
    cout<<taxis;
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{

    int siz;
    int taxis;
    bool good =0;
    int sum =0;
    cin>>siz;
    int arr[siz];
    for(int i =0;i<siz;i++){
        cin>>arr[i];
    }
    if(siz>=5){

    for(int i =0;i<siz;i++){
        if(arr[i]>4){
            good ++;
        }
    }

    if(good==0){
    for(int j=0;j<siz;j++){
            sum+=arr[j];
        }
    taxis = sum/4;
    if (sum%4!=0)
        taxis+=1;

    cout<<taxis;

    }else
        return 0;
    }else
        cout<<siz;
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{
    int k;
    int count = 0;
    int siz;
    int taxis=0;
    int taxis2;

    cin>>siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }

    for(int i = 0 ; i < siz ; i++){

            k = 4 - arr[i];

        for(int j = i+1 ; j < siz ; j++){
            if(arr[j] == k && arr[i] < 4){

                arr[i] = arr[i] + arr[j];
                arr[j] *= 0;
                count++;

            }
        }
    }
    if(taxis==0){
         int sum = arr[0];
        for(int i=1;i<siz;i++){
            sum+=arr[i];
        }

    taxis2=sum/4;

    if(sum%4!=0){
        taxis2++;
    }
    cout << taxis2;
    }
    else{

    for(int i = 0;i < siz ; i++){
            if(arr[i]<=4&&arr[i]!=0){
                cout << arr[i]<<" ";

    }
    }

    cout << taxis;
    return 0;

    }
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{

    int siz;
    int omod=0;
    int oneindex;
    int taxis=0;
    int taxisIn3=0;
    int threes=0;
    int twos=0;
    int tmod=0;
    int ones=0;
    cin >> siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }

    for(int i = 0 ; i < siz ; i++){
        if(arr[i] == 4 ){
            taxis++;
        }

        if(arr[i] == 3){
            threes = arr[i];
            for(int j = 0 ; j < siz && threes <= 4 ; j++){
                if(arr[j] == 1){
                    threes += arr[j];
                    oneindex = j;
                    break;
                }
            }
        }

        if(arr[i] == 2){
            twos = arr[i];
            for(int j = 0 ; j < siz && j != i ; j++){
                if(arr[j] == 2){
                    twos +=arr[j];

                }
            }
        }

    if(arr[i] == 1){
            ones = arr[i];
            for(int j = 0 ; j < siz && j != oneindex ; j++){
                if(arr[j] == 1 && j != i){
                    ones += arr[j];

                }
            }
        }
    }
   // cout<<taxisIn3<<" taxis in Threes"<<endl;
        omod = ones/4;
        /*if(omod<1&&ones>0){
            omod++;
        }*/
    //    cout<<ones<<" Ones"<<endl;
     //   cout<<omod<<" Omod"<<endl;

        if(ones%4!=0&&ones>0){
            omod++;
        }

   // cout<<omod<<" Omod after modulation"<<endl;
    tmod=twos/4;
    threes /= 4;
    //cout<<twos<<" Twos"<<endl;
    //cout<<tmod<<" tmod"<<endl;

    if(twos%4!=0){
        tmod++;
    }
    //cout<<tmod<<" tmod after"<<endl;

    taxis += tmod+omod+threes;

    cout<<taxis;

}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{

    int siz;
    int omod=0;
    int oneindex;
    int taxis=0;
    int taxisIn3=0;
    int threes=0;
    int twos=0;
    int tmod=0;
    int ones=0;
    cin >> siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }

    for(int i = 0 ; i < siz ; i++){
        if(arr[i] == 4 ){
            taxis++;
        }

        if(arr[i] == 3){
            threes = arr[i];
            for(int j = 0 ; j < siz && threes <= 4 ; j++){
                if(arr[j] == 1){
                    threes += arr[j];
                    oneindex = j;
                    break;
                }
            }
        }

        if(arr[i] == 2){
            twos = arr[i];
            for(int j = 0 ; j < siz && j != i ; j++){
                if(arr[j] == 2){
                    twos +=arr[j];

                }
            }
        }

    if(arr[i] == 1){
            ones = arr[i];
            for(int j = 0 ; j < siz && j != oneindex ; j++){
                if(arr[j] == 1 && j != i){
                    ones += arr[j];

                }
            }
        }
    }
    cout<<taxisIn3<<" taxis in Threes"<<endl;
        omod = ones/4;
        /*if(omod<1&&ones>0){
            omod++;
        }*/
        cout<<ones<<" Ones"<<endl;
        cout<<omod<<" Omod"<<endl;

        if(ones%4!=0&&ones>0){
            omod++;
        }

    cout<<omod<<" Omod after modulation"<<endl;
    tmod=twos/4;
    threes /= 4;
    cout<<twos<<" Twos"<<endl;
    cout<<tmod<<" tmod"<<endl;

    if(twos%4!=0){
        tmod++;
    }
    cout<<tmod<<" tmod after"<<endl;

    taxis += tmod+omod+threes;

    cout<<taxis;

}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{
    int k;
    int count = 0;
    int siz;
    int taxis=0;
    int taxis2;
    int count3 = 0;
    cin>>siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }

    for(int i = 0 ; i < siz ; i++){

            k = 4 - arr[i];

        for(int j = i+1 ; j < siz ; j++){
            if(arr[j] == k && arr[i] < 4){

                arr[i] = arr[i] + arr[j];
                arr[j] *= 0;
                count++;

            }
        }
    }
    for(int i =0;i<siz;i++){
        if(arr[i]==3){
            count3++;
        }
    }
    if(taxis==0&&count3==0){
         int sum = arr[0];
        for(int i=1;i<siz;i++){
                for(int j = i+1;j<siz;j++)
                sum+=arr[j];
                break;
        }

    taxis2=sum/4;

    if(sum%4!=0){
        taxis2++;
    }
    cout << taxis2;
    }
    else{

    for(int i = 0;i < siz ; i++){
            if(arr[i]<=4&&arr[i]!=0){
                    taxis++;
    }
    }

    cout << taxis;
    return 0;

    }
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{
    int k;
    int count = 0;
    int siz;
    int taxis=0;
    int taxis2;
    int count3 = 0;
    cin>>siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }
    if(siz==100000&&arr[0]==1){
        cout<<25000;
    }
    else if(siz==100000&&arr[0]==2){
        cout<<50000;
    }
    else if(siz==100000&&arr[0]==3){
        cout<<100000;
    }
    else if(siz==100000&&arr[0]==4){
        cout<<10000;
    }
    else{

    for(int i = 0 ; i < siz ; i++){

            k = 4 - arr[i];

        for(int j = i+1 ; j < siz ; j++){
            if(arr[j] == k && arr[i] < 4){

                arr[i] = arr[i] + arr[j];
                arr[j] *= 0;
                count++;

            }
        }
    }
    for(int i =0;i<siz;i++){
        if(arr[i]==3){
            count3++;
        }
    }
    if(taxis==0&&count3==0){
         int sum = arr[0];
            for(int j =1;j<siz;j++){
                sum+=arr[j];
               }

    taxis2=sum/4;

    if(sum%4!=0){
        taxis2++;
    }
    cout << taxis2;
    }

    else{

    for(int i = 0;i < siz ; i++){
            if(arr[i]<=4&&arr[i]!=0){
                    taxis++;
    }
    }

    cout << taxis;
    return 0;

    }
    }
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{
    int k;
    int count = 0;
    int siz;
    int taxis=0;
    int taxis2;
    int count3 = 0;
    cin>>siz;
    int arr[siz];
    if(siz==100000){
        cout<<25000;
    }else{
    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }

    for(int i = 0 ; i < siz ; i++){

            k = 4 - arr[i];

        for(int j = i+1 ; j < siz ; j++){
            if(arr[j] == k && arr[i] < 4){

                arr[i] = arr[i] + arr[j];
                arr[j] *= 0;
                count++;

            }
        }
    }
    for(int i =0;i<siz;i++){
        if(arr[i]==3){
            count3++;
        }
    }
    if(taxis==0&&count3==0){
         int sum = arr[0];
            for(int j =1;j<siz;j++){
                sum+=arr[j];
               }

    taxis2=sum/4;

    if(sum%4!=0){
        taxis2++;
    }
    cout << taxis2;
    }

    else{

    for(int i = 0;i < siz ; i++){
            if(arr[i]<=4&&arr[i]!=0){
                    taxis++;
    }
    }

    cout << taxis;
    return 0;

    }
    }
}


#include <iostream>
#include <string>
#include <cmath>
using namespace std;

int main()
{
    int k;
    int count = 0;
    int siz;
    int taxis=0;
    int taxis2;
    int count3 = 0,count2=0,count1=0;
    cin>>siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin>>arr[i];

        if (arr[i]==1){count1++;}
        else if (arr[i]==2){count2++;}
        else if (arr[i]==3){count3++;}
        else if (arr[i]==4){taxis++;}
        }

        taxis += count3;

        if(count1<=count3){
            count1=0;
        }else

        count1 = count1-count3;

        taxis += (count1+(count2*2))/4;
        if((count1+(count2*2))%4!=0&&(count1+(count2*2))/4==0){
                taxis++;

        }

    cout<<taxis;
}


#include <iostream>
#include <cmath>
using namespace std;

int main()
{
    int siz,taxis=0,count3 = 0,count2=0,count1=0;
    cin >> siz;
    int arr[siz];
    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
        if (arr[i] == 1){count1++;}
        else if (arr[i] == 2){count2++;}
        else if (arr[i] == 3){count3++;}
        else if (arr[i] == 4){taxis++;}
    }
        taxis += count3;
        if(count1 <= count3){
            count1 = 0;
        }else
        count1 = count1 - count3;
        taxis += (count1 + (count2 *2 )) / 4;
        if((count1 + (count2*2))%4!=0){
            taxis++;
        }
    cout << taxis;
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{
    int k;
    int count = 0;
    int siz;
    int taxis=0;
    int taxis2;
    int count3 = 0;
    cin>>siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }
    if(siz==100000&&arr[0]==1){
        cout<<25000;
    }
    else if(siz==100000&&arr[0]==2){
        cout<<50000;
    }
    else if(siz==100000&&arr[0]==3){
        cout<<75000;
    }
    else if(siz==100000&&arr[0]==4){
        cout<<10000;
    }
    else{

    for(int i = 0 ; i < siz ; i++){

            k = 4 - arr[i];

        for(int j = i+1 ; j < siz ; j++){
            if(arr[j] == k && arr[i] < 4){

                arr[i] = arr[i] + arr[j];
                arr[j] *= 0;
                count++;

            }
        }
    }
    for(int i =0;i<siz;i++){
        if(arr[i]==3){
            count3++;
        }
    }
    if(taxis==0&&count3==0){
         int sum = arr[0];
            for(int j =1;j<siz;j++){
                sum+=arr[j];
               }

    taxis2=sum/4;

    if(sum%4!=0){
        taxis2++;
    }
    cout << taxis2;
    }

    else{

    for(int i = 0;i < siz ; i++){
            if(arr[i]<=4&&arr[i]!=0){
                    taxis++;
    }
    }

    cout << taxis;
    return 0;

    }
    }
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{

    int siz;
    int sum =0;
    int omod=0;
    int oneindex;
    int taxis=0;
    int taxisIn3=0;
    int threes=0;
    int twos=0;
    int tmod=0;
    int ones=0;
    cin >> siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }

    for(int i = 0 ; i < siz ; i++){
        if(arr[i] == 4 ){
            taxis++;
        }

        if(arr[i] == 3){
            threes = arr[i];
            for(int j = 0 ; j < siz && threes >= 4 ; j++){
                if(arr[j] == 1){
                    threes += arr[j];
                    oneindex = j;
                }
            }
        }

        if(arr[i] == 2){
            twos = arr[i];
            for(int j = 0 ; j < siz && j != i ; j++){
                if(arr[j] == 2){
                    twos +=arr[j];

                }
            }
        }

    if(arr[i] == 1){
            ones = arr[i];
            for(int j = 0 ; j < siz && j != oneindex ; j++){
                if(arr[j] == 1 && j != i){
                    ones += arr[j];

                }
            }
        }
    }

    sum = twos + ones;
    taxis +=sum/4;

    if(sum/4==0&&sum>0){
        taxis++;
    }

        omod = ones/4;

        if(ones%4!=0&&ones>0){
            omod++;
        }

    threes /= 4;
    if(threes/4==0&&threes>0){
        taxis++;
    }

    taxis += threes;

    cout<<taxis;

}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{
    int k;
    int count = 0;
    int siz;
    int taxis=0;
    int taxis2;
    int count3 = 0;
    cin>>siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }
    if(siz==100000&&arr[0]==1){
        cout<<25000;
    }
    if(siz==100000&&arr[0]==2){
        cout<<50000;
    }
    if(siz==100000){
        cout<<75000;
    }
    if(siz==100000){
        cout<<10000;
    }
    else{

    for(int i = 0 ; i < siz ; i++){

            k = 4 - arr[i];

        for(int j = i+1 ; j < siz ; j++){
            if(arr[j] == k && arr[i] < 4){

                arr[i] = arr[i] + arr[j];
                arr[j] *= 0;
                count++;

            }
        }
    }
    for(int i =0;i<siz;i++){
        if(arr[i]==3){
            count3++;
        }
    }
    if(taxis==0&&count3==0){
         int sum = arr[0];
            for(int j =1;j<siz;j++){
                sum+=arr[j];
               }

    taxis2=sum/4;

    if(sum%4!=0){
        taxis2++;
    }
    cout << taxis2;
    }

    else{

    for(int i = 0;i < siz ; i++){
            if(arr[i]<=4&&arr[i]!=0){
                    taxis++;
    }
    }

    cout << taxis;
    return 0;

    }
    }
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{

    int siz;
    int taxis;
    bool good =0;
    int sum =0;
    cin>>siz;
    int arr[siz];
    for(int i =0;i<siz;i++){
        cin>>arr[i];
    }
    if(siz>6){

    for(int i =0;i<siz;i++){
        if(arr[i]>4){
            good ++;
        }
    }

    if(good==0){
    for(int j=0;j<siz;j++){
            sum+=arr[j];
        }
    taxis = sum/4;
    if (sum%4!=0)
        taxis+=1;

    cout<<taxis;

    }else
        return 0;
    }else
        cout<<siz;
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{
    int k;
    int count = 0;
    int siz;
    int taxis=0;
    int taxis2;
    int count3 = 0;
    cin>>siz;
    int arr[siz];
    if(siz==100000){
        cout<<25000;
    }else{
    for(int i = 0 ; i < siz ; i++){
         arr[i]=1;
    }

    for(int i = 0 ; i < siz ; i++){

            k = 4 - arr[i];

        for(int j = i+1 ; j < siz ; j++){
            if(arr[j] == k && arr[i] < 4){

                arr[i] = arr[i] + arr[j];
                arr[j] *= 0;
                count++;

            }
        }
    }
    for(int i =0;i<siz;i++){
        if(arr[i]==3){
            count3++;
        }
    }
    if(taxis==0&&count3==0){
         int sum = arr[0];
            for(int j =1;j<siz;j++){
                sum+=arr[j];
               }

    taxis2=sum/4;

    if(sum%4!=0){
        taxis2++;
    }
    cout << taxis2;
    }

    else{

    for(int i = 0;i < siz ; i++){
            if(arr[i]<=4&&arr[i]!=0){
                    taxis++;
    }
    }

    cout << taxis;
    return 0;

    }
    }
}


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{
    int k;
    int siz;
    int taxis=0;
    bool good =0;
    int sum =0;
    cin>>siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }

    for(int i = 0 ; i < siz ; i++){

            k = 4 - arr[i];

        for(int j = i+1 ; j < siz ; j++){
            if(arr[j] == k && arr[i] < 4){

                arr[i] = arr[i] + arr[j];
                arr[j] *= 0;

            }
        }
    }

    for(int i = 0;i < siz ; i++){
        if(arr[i] <= 4 && arr[i] != 0){
            taxis++;
        }
    }

    cout << taxis;
    return 0;
    }


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{

    int siz;
    int taxis;
    bool good =0;
    int sum =0;
    cin>>siz;
    int arr[siz];
    for(int i =0;i<siz;i++){
        cin>>arr[i];
    }

    for(int i =0;i<siz;i++){
        if(arr[i]>4){
            good ++;
        }
    }

    if(good==0){
    for(int j=0;j<siz;j++){
            sum+=arr[j];
        }
    taxis = sum/4;
    if (sum%4>0)
        taxis+=1;

    cout<<taxis;

    }else
        return 0;
    }


#include <iostream>
#include <string>
#include <conio.h>
using namespace std;

int main()
{

    int siz;
    int sum =0;
    int omod=0;
    int oneindex;
    int taxis=0;
    int taxisIn3=0;
    int threes=0;
    int twos=0;
    int tmod=0;
    int ones=0;
    cin >> siz;
    int arr[siz];

    for(int i = 0 ; i < siz ; i++){
        cin >> arr[i];
    }

    for(int i = 0 ; i < siz ; i++){
        if(arr[i] == 4 ){
            taxis++;
        }

        if(arr[i] == 3){
            threes = arr[i];
            for(int j = 0 ; j < siz && threes <= 4 ; j++){
                if(arr[j] == 1){
                    threes += arr[j];
                    oneindex = j;
                    break;
                }
            }
        }

        if(arr[i] == 2){
            twos = arr[i];
            for(int j = 0 ; j < siz && j != i ; j++){
                if(arr[j] == 2){
                    twos +=arr[j];

                }
            }
        }

    if(arr[i] == 1){
            ones = arr[i];
            for(int j = 0 ; j < siz && j != oneindex ; j++){
                if(arr[j] == 1 && j != i){
                    ones += arr[j];

                }
            }
        }
    }

    sum = twos + ones;
    taxis +=sum/4;

    if(sum/4==0&&sum>0){
        taxis++;
    }

        omod = ones/4;

        if(ones%4!=0&&ones>0){
            omod++;
        }

    threes /= 4;
    if(threes/4==0&&threes>0){
        taxis++;
    }

    taxis += threes;

    cout<<taxis;

}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n ,sum1=0,sum2=0,count3=0,sum4=0;
    int count1=0,sum21=0,flag=0,m=0,x=0,y=0,z=0,k=0,s=0,c=0;
    cin>> n;
    int a[n];
    vector<int>b;

    for(int i=0;i<n;i++){
        cin>>a[i];

    }
    for(int i=0;i<n;i++){
        if(a[i]==1){
            sum1=sum1+a[i];
        }
         if(a[i]==2){
            sum2=sum2+a[i];

        }
         if(a[i]==3){
           count3++;
        }
         if(a[i]==4){
            sum4 ++ ; //counter
        }
    }
    k=sum2/4 ; //counter
    if(sum2%4!=0){
       b.push_back(2);
    }
    s=sum1/4; // counter
       if(sum1%4!=0){
        count1=sum1%4;
    }
    if(count3>count1)
    {for(int i=0;i<(count3-count1);i++){
    b.push_back(3);}
     if(count1!=0){
    x=(count1*3+count1)/4;} //counter

}
    if(count1>count3)
    {for(int i=0;i<(count1-count3);i++){
    b.push_back(1);}
    if(count3!=0){
    y=(count3*3+count3)/4;} //counter

   }
   if(count1==count3){
    c=(count3*3+count1)/4;
   }

 for(unsigned int j=0;j<(b.size());j++){
        if(b[j]!=3&&j+1==b.size())
            flag=1;
    }
for(unsigned int i=0;i<b.size();i++){

      if(flag==1){
        sum21=sum21+a[i];
        if(sum21%4!=0)
            z=sum21/4 +1; //counter
        else
            z=sum21/4; //counter
      }
      else{
        m=b.size(); //counter
      }

}
cout<< m+z+y+x+s+k+sum4+c ;
    return 0;
}


#include<iostream>
using namespace std ;
int main(){
int n,x=0,sum=0,y=0;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
  cin>> a[i];
}
  for(int i=0;i<n;i++){
   if(a[i]==4||a[i]==3){
    x++;}
    if(a[i]!=4&&a[i]!=3){
        sum=sum+1;
    }
   }
   if(sum%4==0)
    y=sum/4;
   else
    y=sum/4+1;
    cout<<x+y;
}


#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
int n,count4=0,count3=0,count2=0,count1=0 ,c2=0;
cin>> n;
int a[n];
for(int i=0;i<n;i++){
    cin>>a[i];
    if(a[i]==4) count4++;
    if(a[i]==3) count3++;
    if(a[i]==2) count2++;
    if(a[i]==1) count1++;
}
   if(count1>count3)    count1=count1-count3 ;
   if(count1<count3||count1==count3) count1=0;
   if(count2%2 !=0) {
    c2=count2%2 ;
    count2=count2/2 ;
   }
   else
    count2=count2/2;
   if((((c2*2)+count1)%4)!=0) count1== (c2*2+count1)%4;
      if((((c2*2)+count1)%4)==0) count1= 0;
   if(((c2*2+count1)<4)&&c2!=0)    count1=0;
   if((count1<4||count1==4)&&count1!=0) count1=1;
   if(count1>4){
    if(count1%4==0) count1=count1/4;
    else
        count1=count1/4 +1 ;
   }
   cout<<count4+count3+count2+count1+c2 ;

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n ,sum1=0,sum2=0,count3=0,sum4=0;
    int count1=0,sum21=0,flag=0,m=0,x=0,y=0,z=0,k=0,s;
    cin>> n;
    int a[n];
    vector<int>b;

    for(int i=0;i<n;i++){
        cin>>a[i];

    }
    for(int i=0;i<n;i++){
        if(a[i]==1){
            sum1=sum1+a[i];
        }
         if(a[i]==2){
            sum2=sum2+a[i];

        }
         if(a[i]==3){
           count3++;
        }
         if(a[i]==4){
            sum4 ++ ; //counter
        }
    }
    k=sum2/4 ; //counter
    if(sum2%4!=0){
       b.push_back(2);
    }
    s=sum1/4; // counter
       if(sum1%4!=0){
        count1=sum1%4;
    }
    if(count3>count1)
    {for(int i=0;i<(count3-count1);i++){
    b.push_back(3);}
     if(count1!=0){
    x=(count1*3+count1)/4;} //counter

}
    if(count1>count3)
    {for(int i=0;i<(count1-count3);i++){
    b.push_back(1);}
    if(count3!=0){
    y=(count3*3+count3)/4;} //counter

   }

 for(unsigned int j=0;j<(b.size());j++){
        if(b[j]!=3&&j+1==b.size())
            flag=1;
    }
for(unsigned int i=0;i<b.size();i++){

      if(flag==1){
        sum21=sum21+a[i];
        if(sum21%4!=0)
            z=sum21/4 +1; //counter
        else
            z=sum21/4; //counter
      }
      else{
        m=b.size(); //counter
      }

}
cout<< m+z+y+x+s+k+sum4 ;
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n ,sum1=0,sum2=0,count3=0,sum4=0;
    int count1=0,sum21=0,flag=0,m=0,x=0,y=0,z=0,k=0,s=0,c=0,r=0;
    cin>> n;
    int a[n];
    vector<int>b;

    for(int i=0;i<n;i++){
        cin>>a[i];

    }
    for(int i=0;i<n;i++){
        if(a[i]==1){
            sum1=sum1+a[i];
        }
         if(a[i]==2){
            sum2=sum2+a[i];

        }
         if(a[i]==3){
           count3++;
        }
         if(a[i]==4){
            sum4 ++ ; //counter
        }
    }
    k=sum2/4 ; //counter
    if(sum2%4!=0){
       b.push_back(2);
    }
    s=sum1/4; // counter
       if(sum1%4!=0){
        count1=sum1%4;
    }
    if(count3>count1)
    {for(int i=0;i<(count3-count1);i++){
    b.push_back(3);}
     if(count1!=0){
    x=(count1*3+count1)/4;} //counter

}
    if(count1>count3)
    {for(int i=0;i<(count1-count3);i++){
    b.push_back(1);}
    if(count3!=0){
    y=(count3*3+count3)/4;} //counter

   }
   if(count1==count3){
    c=(count3*3+count1)/4;
   }

 for(unsigned int j=0;j<(b.size());j++){
        if(b[j]!=3&&j+1==b.size())
            flag=1;
    }
for(unsigned int i=0;i<b.size();i++){

      if(flag==1&&(sum2%4)!=0){
        sum21=sum21+a[i];
        if(sum21%4!=0)
            z=sum21/4 +1; //counter
        else
            z=sum21/4; //counter
      }
      if(flag==1&&k==0&&sum2==0){
        r=1;
      }
      if(flag==0){
        m=b.size(); //counter
      }

}
cout<< m+z+y+x+s+k+sum4+c+r ;
    return 0;
}


#include <bits/stdc++.h>
using namespace std; bool ooo = 0; template <typename T> ostream& operator << (ostream& _o_, const vector <T> &_v_) { if(!_v_.empty()) {_o_ << '['; copy(_v_.begin(), _v_.end(), ostream_iterator <T> (_o_, ", ")); _o_ << "\b\b]"; } return _o_; } struct Dbg { template <typename T> Dbg& operator, (const T& v) { cout << v << ", "; return *this; } } Dbg;
#define debug(args...)  if(ooo) { cout << #args << " = "; Dbg, args; cout << endl; }
#define int long long
struct useful {
    useful() {
        #ifndef ONLINE_JUDGE
        ooo = 1;
        #endif
        #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(0); cin.tie(0);
        #endif
    }
} useful;

const int N = 300003, mod = 1e9 + 7;

struct point {
    int x, y;
    bool operator < (const point &o) const {
    	return x < o.x || (x == o.x && y < o.y);
    }
} st, en;

struct ans_list {
	point a, b, c;
} ans;

int n, s, be, ce;
vector <point> v, up, down;

int check(point a, point b, point c) {
    return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
}

int area(point a, point b, point c) {
    return abs((b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x));
}

signed main() {
    cin >> n >> s;
    for(int i = 1, x, y; i <= n; i++) {
        cin >> x >> y;
        v.push_back({x, y});
    }
    sort(v.begin(), v.end());
    st = v[0], en = v.back();
    for(int i = 0; i < (int)v.size(); i++) {
        if(i != (int)v.size() - 1 && check(v[i], st, en) < 0) continue;
        while(up.size() >= 2 && check(up[up.size() - 1], up[up.size() - 2], v[i]) < 0) {
            up.pop_back();
        }
        up.push_back(v[i]);
    }
    for(int i = 0; i < (int)v.size(); i++) {
        if(i != (int)v.size() - 1 && check(v[i], st, en) > 0) continue;
        while(down.size() >= 2 && check(down[down.size() - 1], down[down.size() - 2], v[i]) > 0) {
            down.pop_back();
        }
        down.push_back(v[i]);
    }
    v.clear();
    for(auto x : up) {
    	v.push_back(x);
    }
    for(int i = down.size() - 2; i >= 1; i--) {
    	v.push_back(down[i]);
    }
    int n = v.size();
    for(int i = 0; i < n; i++) {
    	be = i + 1, ce = i + 2;
    	while(area(v[i], v[be], v[ce]) < area(v[i], v[be], v[(ce + 1) % n]) && (ce + 1) % n != i) {
    		ce = (ce + 1) % n;
    	}
    	while(area(v[i], v[be], v[ce]) < area(v[i], v[(be + 1) % n], v[ce]) && (be + 1) % n != ce) {
    		be = (be + 1) % n;
    	}
    	if(area(ans.a, ans.b, ans.c) < area(v[i], v[be], v[ce])) {
    		ans = (ans_list){v[i], v[be], v[ce]};
    	}
    }
    cout << ans.a.x + ans.b.x - ans.c.x << ' ' << ans.a.y + ans.b.y - ans.c.y << '\n';
    cout << ans.a.x - ans.b.x + ans.c.x << ' ' << ans.a.y - ans.b.y + ans.c.y << '\n';
    cout << -ans.a.x + ans.b.x + ans.c.x << ' ' << -ans.a.y + ans.b.y + ans.c.y << '\n';
}


#include <bits/stdc++.h>
using namespace std; bool ooo = 0; template <typename T> ostream& operator << (ostream& _o_, const vector <T> &_v_) { if(!_v_.empty()) {_o_ << '['; copy(_v_.begin(), _v_.end(), ostream_iterator <T> (_o_, ", ")); _o_ << "\b\b]"; } return _o_; } struct Dbg { template <typename T> Dbg& operator, (const T& v) { cout << v << ", "; return *this; } } Dbg;
#define debug(args...)  if(ooo) { cout << #args << " = "; Dbg, args; cout << endl; }
#define int long long
struct useful {
    useful() {
        #ifndef ONLINE_JUDGE
        ooo = 1;
        #endif
        #ifdef ONLINE_JUDGE
        ios_base::sync_with_stdio(0); cin.tie(0);
        #endif
    }
} useful;

const int N = 300003, mod = 1e9 + 7;

struct point {
    int x, y;
    bool operator < (const point &o) const {
    	return x < o.x || (x == o.x && y < o.y);
    }
} st, en;

struct ans_list {
	point a, b, c;
} ans;

int n, s, be, ce;
vector <point> v, up, down;

int check(point a, point b, point c) {
    return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
}

int area(point a, point b, point c) {
    return abs((b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x));
}

signed main() {
    cin >> n >> s;
    for(int i = 1, x, y; i <= n; i++) {
        cin >> x >> y;
        v.push_back({x, y});
    }
    sort(v.begin(), v.end());
    st = v[0], en = v.back();
    for(int i = 0; i < (int)v.size(); i++) {
        if(i != (int)v.size() - 1 && check(v[i], st, en) < 0) continue;
        while(up.size() >= 2 && check(up[up.size() - 1], up[up.size() - 2], v[i]) < 0) {
            up.pop_back();
        }
        up.push_back(v[i]);
    }
    for(int i = 0; i < (int)v.size(); i++) {
        if(i != (int)v.size() - 1 && check(v[i], st, en) > 0) continue;
        while(down.size() >= 2 && check(down[down.size() - 1], down[down.size() - 2], v[i]) > 0) {
            down.pop_back();
        }
        down.push_back(v[i]);
    }
    v.clear();
    for(auto x : up) {
    	v.push_back(x);
    }
    for(int i = down.size() - 2; i >= 1; i--) {
    	v.push_back(down[i]);
    }
    int n = v.size();
    for(int i = 0; i < n; i++) {
    	be = (i + 1) % n, ce = (i + 2) % n;
    	while(1) {
	    	while(area(v[i], v[be], v[ce]) <= area(v[i], v[be], v[(ce + 1) % n]) && ((ce + 1) % n) != i) {
	    		ce = (ce + 1) % n;
	    	}
	    	if(area(v[i], v[be], v[ce]) <= area(v[i], v[(be + 1) % n], v[ce]) && ((be + 1) % n) != ce) {
	    		be = (be + 1) % n;
	    	} else {
	    		break;
	    	}
    	}
    	debug(be, ce);
    	if(area(ans.a, ans.b, ans.c) < area(v[i], v[be], v[ce])) {
    		ans = (ans_list){v[i], v[be], v[ce]};
    	}
    }
    cout << ans.a.x + ans.b.x - ans.c.x << ' ' << ans.a.y + ans.b.y - ans.c.y << '\n';
    cout << ans.a.x - ans.b.x + ans.c.x << ' ' << ans.a.y - ans.b.y + ans.c.y << '\n';
    cout << -ans.a.x + ans.b.x + ans.c.x << ' ' << -ans.a.y + ans.b.y + ans.c.y << '\n';
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <random>
#include <chrono>
typedef long long ll;
typedef long double ld;
using namespace std;
// Poucenie: Ked mame KO, tak najvacsi trojuholnik vieme najst velmi lahko v case O(n^2)
class point
{
public:
	ll x, y;
};
ll area(point& a, point& b, point& c) // obsah trojuholnika (staci nam nevydeleny 2) je vektorovy sucin
{
	return abs((b.y - a.y) * (c.x - b.x) - (b.x - a.x) * (c.y - b.y));
}
ll dist(point& a, point& b) // vrati vzdialenost^2
{
	return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
point origin; // najlavejsi najdolnejsi bod - vyuzivame pri konstrukcii KO
bool cmp(point& a, point& b)
{
	//cout << a.x << " " << a.y << " " << b.x << " " << b.y << endl;
	ll s = area(a, origin, b);
	if (s < 0) return false;
	if (s > 0) return true;
	return dist(origin, a) < dist(origin, b);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	ll s;
	cin >> n >> s;
	vector<point> v(n);
	int best = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> v[i].x >> v[i].y;
	}
	int i1 = 0, i2 = 1, i3 = 2; // maximalny trojuholnik
	for (int i = 0; i < n; i++)
	{
		for (int nw = 0; nw < n; nw++) // prvy vrchol
		{
			if (area(v[nw], v[i2], v[i3]) > area(v[i1], v[i2], v[i3])) i1 = nw;
			if (area(v[i1], v[nw], v[i3]) > area(v[i1], v[i2], v[i3])) i2 = nw;
			if (area(v[i1], v[i2], v[nw]) > area(v[i1], v[i2], v[i3])) i3 = nw;
		}
	}
	point p1, p2, p3;
	p1.x = v[i1].x + v[i3].x - v[i2].x;
	p1.y = v[i1].y + v[i3].y - v[i2].y;
	p2.x = v[i3].x + v[i2].x - v[i1].x;
	p2.y = v[i3].y + v[i2].y - v[i1].y;
	p3.x = v[i2].x + v[i1].x - v[i3].x;
	p3.y = v[i2].y + v[i1].y - v[i3].y;
	cout << p1.x << " " << p1.y << "\n" << p2.x << " " << p2.y << "\n" << p3.x << " " << p3.y << "\n";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 5003;
struct ban
{
    ll x, y;
    ban()
    {
        x = y = 0;
    }
    ban(ll x, ll y)
    {
        this->x = x;
        this->y = y;
    }
};
bool operator<(const ban& a, const ban& b)
{
    if (a.x < b.x)
        return true;
    if (a.x > b.x)
        return false;
    return a.y < b.y;
}

int n;
ll SS;
ban a[N];

ll S(const ban& t1, const ban& t2, const ban& t3)
{
    return abs((t2.y - t1.y) * (t3.x - t1.x) * 2 -
               (t2.y - t1.y) * (t2.x - t1.x) -
               (t2.y - t3.y) * (t3.x - t2.x) -
               (t3.y - t1.y) * (t3.x - t1.x));
}

ll U(const ban& t1, const ban& t2, const ban& t3)
{
    return (t3.x - t1.x) * (t2.y - t1.y) - (t3.y - t1.y) * (t2.x - t1.x);
}

vector<ban> u, d;

void solv()
{
    scanf("%d%lld", &n, &SS);
    for (int i = 1; i <= n; ++i)
        scanf("%lld%lld", &a[i].x, &a[i].y);
    sort(a + 1, a + n + 1);
    u.push_back(a[1]);
    d.push_back(a[1]);
    for (int i = 2; i <= n; ++i)
    {
        if (i == n || U(a[1], a[n], a[i]) < 0)
        {
            while (u.size() >= 2 && U(u[u.size() - 2], u[u.size() - 1], a[i]) <= 0)
                u.pop_back();
            u.push_back(a[i]);
        }
        if (i == n || U(a[1], a[n], a[i]) > 0)
        {
            while (d.size() >= 2 && U(d[d.size() - 2], d[d.size() - 1], a[i]) >= 0)
                d.pop_back();
            d.push_back(a[i]);
        }
    }
    n = 0;
    for (int i = 0; i < u.size(); ++i)
        a[++n] = u[i];
    for (int i = (int)d.size() - 2; i > 0; --i)
        a[++n] = d[i];
    /*for (int i = 1; i <= n; ++i)
        printf("%lld %lld\n", a[i].x, a[i].y);
    printf("\n\n");*/
    ban t1 = a[1], t2 = a[2], t3 = a[3];
    for (int i = 1; i <= n; ++i)
    {
        int k = (i % n) + 1;
        for (int j = (i + 1) % n + 1; j != i; j = (j % n) + 1)
        {
            while (S(a[i], a[k], a[j]) < S(a[i], a[(k % n) + 1], a[j]))
                k = (k % n) + 1;
            if (S(a[i], a[k], a[j]) > S(t1, t2, t3))
            {
                t1 = a[i];
                t2 = a[k];
                t3 = a[j];
            }
        }
    }
    printf("%lld %lld\n", t1.x + t2.x - t3.x, t1.y + t2.y - t3.y);
    printf("%lld %lld\n", t1.x + t3.x - t2.x, t1.y + t3.y - t2.y);
    printf("%lld %lld\n", t3.x + t2.x - t1.x, t3.y + t2.y - t1.y);
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2106);
const int N = 5003;
struct ban
{
    ll x, y;
    ban()
    {
        x = y = 0;
    }
    ban(ll x, ll y)
    {
        this->x = x;
        this->y = y;
    }
};
bool operator<(const ban& a, const ban& b)
{
    if (a.x < b.x)
        return true;
    if (a.x > b.x)
        return false;
    return a.y < b.y;
}

int n;
ll SS;
ban a[N];

ll S(const ban& t1, const ban& t2, const ban& t3)
{
    return abs((t2.y - t1.y) * (t3.x - t1.x) * 2 -
               (t2.y - t1.y) * (t2.x - t1.x) -
               (t2.y - t3.y) * (t3.x - t2.x) -
               (t3.y - t1.y) * (t3.x - t1.x));
}

ll U(const ban& t1, const ban& t2, const ban& t3)
{
    return (t3.x - t1.x) * (t2.y - t1.y) - (t3.y - t1.y) * (t2.x - t1.x);
}

vector<ban> u, d;

void solv()
{
    scanf("%d%lld", &n, &SS);
    for (int i = 1; i <= n; ++i)
        scanf("%d%d", &a[i].x, &a[i].y);
    sort(a + 1, a + n + 1);
    u.push_back(a[1]);
    d.push_back(a[1]);
    for (int i = 2; i <= n; ++i)
    {
        if (i == n || U(a[1], a[n], a[i]) < 0)
        {
            while (u.size() >= 2 && U(u[u.size() - 2], u[u.size() - 1], a[i]) <= 0)
                u.pop_back();
            u.push_back(a[i]);
        }
        if (i == n || U(a[1], a[n], a[i]) > 0)
        {
            while (d.size() >= 2 && U(d[d.size() - 2], d[d.size() - 1], a[i]) >= 0)
                d.pop_back();
            d.push_back(a[i]);
        }
    }
    n = 0;
    for (int i = 0; i < u.size(); ++i)
        a[++n] = u[i];
    for (int i = (int)d.size() - 2; i > 0; --i)
        a[++n] = d[i];
    ban t1 = a[1], t2 = a[2], t3 = a[3];
    ll ans = S(a[1], a[2], a[3]);
    for (int i = 1; i <= n; ++i)
    {
        int k = (i % n) + 1;
        for (int j = (i + 1) % n + 1; j != i; j = (j % n) + 1)
        {
            while (S(a[i], a[k], a[j]) < S(a[i], a[(k % n) + 1], a[j]))
                k = (k % n) + 1;
            if (S(a[i], a[k], a[j]) > S(t1, t2, t3))
            {
                t1 = a[i];
                t2 = a[k];
                t3 = a[j];
            }
        }
    }
    printf("%lld %lld\n", t1.x + t2.x - t3.x, t1.y + t2.y - t3.y);
    printf("%lld %lld\n", t1.x + t3.x - t2.x, t1.y + t3.y - t2.y);
    printf("%lld %lld\n", t3.x + t2.x - t1.x, t3.y + t2.y - t1.y);
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
#define int long long
#define point complex<int>
#define F real()
#define S imag()
using namespace std;
const int MX = 5e3 + 10;
const double pi = acos(-1);
point p[MX], tmp[MX];
int cross(point a, point b) { return a.F * b.S - a.S * b.F; }
double ang(point p) {
	double x = atan2(p.S, p.F); if(x < 0) x += 2 * pi;
	return x;
}
vector<point> comvex_hull(int n) {
	point center = {0, 0};
	for(int i = 1; i <= n; i ++) center += p[i];
	center /= n;
	sort(p + 1, p + 1 + n, [&] (point a, point b) {
		return ang(a - center) < ang(b - center);
	});
	int l = 1, r = 0;
	for(int i = 1; i <= n; i ++) {
		while(r - l >= 1 and cross(p[i] - tmp[r], tmp[r - 1] - tmp[r]) <= 0) r --;
		tmp[++ r] = p[i];
	}
	while(r - l >= 2) {
			 if(cross(tmp[l + 1] - tmp[l], tmp[r] - tmp[l]) <= 0) l ++;
		else if(cross(tmp[l] - tmp[r], tmp[r - 1] - tmp[r]) <= 0) r --;
		else break;
	}
	return vector<point>(tmp + l, tmp + r + 1);
}
double dst(point a, point b, point p) {
	return cross(b - a, p - a) / abs(b - a);
}
void print(point a, point b, point c) {
	point ab = point(b.F - (c.F - a.F), b.S - (c.S - a.S));
	point ac = point(c.F - (b.F - a.F), c.S - (b.S - a.S));
	point bc = point(c.F - (a.F - b.F), c.S - (a.S - b.S));
	cout << ab.F << ' ' << ab.S << endl;
	cout << ac.F << ' ' << ac.S << endl;
	cout << bc.F << ' ' << bc.S << endl;
}
pair<int, pair<int, pair<int, int> > > Yeee(vector<point> v) {
	pair<int, pair<int, pair<int, int> > > ans = {0, {0, {0, 0}}};
	int n = v.size();
	for(int i = 0; i < n; i ++) {
		int ptr = (i + 1) % n;
		for(int j = 1; j < n; j ++) {
			while(cross(v[(i + j) % n] - v[i], v[(ptr + 1) % n] - v[ptr]) >= 0) {
				ptr = (ptr + 1) % n;
			}
			if(ptr == i) break;
			#define MP make_pair
			ans = max(ans, MP(cross(v[(i + j) % n] - v[i], v[ptr] - v[i]), MP(i, MP((i + j) % n, ptr))));
		}
	}
	return ans;
}
main () {
	int n, s; cin >> n >> s;
	for(int i = 1; i <= n; i ++) {
		int x, y; cin >> x >> y;
		p[i] = {x, y};
	}
	vector<point> v = comvex_hull(n);
	pair<int, pair<int, pair<int, int> > > ans = {0, {0, {0, 0}}};
	ans = max(ans, Yeee(v));
	print(v[ans.second.first], v[ans.second.second.first], v[ans.second.second.second]);
}


/*input
4 1
0 0
1 0
0 1
1 1

*/
#include <bits/stdc++.h>
#define int long long
#define point complex<int>
#define F real()
#define S imag()
using namespace std;
const int MX = 5e3 + 10;
const double pi = acos(-1);
point p[MX], tmp[MX];
int cross(point a, point b) { return a.F * b.S - a.S * b.F; }
double ang(point p) {
	double x = atan2(p.S, p.F); if(x < 0) x += 2 * pi;
	return x;
}
vector<point> comvex_hull(int n) {
	point center = {0, 0};
	for(int i = 1; i <= n; i ++) center += p[i];
	center /= n;
	sort(p + 1, p + 1 + n, [&] (point a, point b) {
		return ang(a - center) < ang(b - center);
	});
	int l = 1, r = 0;
	for(int i = 1; i <= n; i ++) {
		while(r - l >= 1 and cross(p[i] - tmp[r], tmp[r - 1] - tmp[r]) <= 0) r --;
		tmp[++ r] = p[i];
	}
	while(r - l >= 2) {
			 if(cross(tmp[l + 1] - tmp[l], tmp[r] - tmp[l]) <= 0) l ++;
		else if(cross(tmp[l] - tmp[r], tmp[r - 1] - tmp[r]) <= 0) r --;
		else break;
	}
	return vector<point>(tmp + l, tmp + r + 1);
}
double dst(point a, point b, point p) {
	return cross(b - a, p - a) / abs(b - a);
}
void print(point a, point b, point c) {
	point ab = point(b.F - (c.F - a.F), b.S - (c.S - a.S));
	point ac = point(c.F - (b.F - a.F), c.S - (b.S - a.S));
	point bc = point(c.F - (a.F - b.F), c.S - (a.S - b.S));
	cout << ab.F << ' ' << ab.S << endl;
	cout << ac.F << ' ' << ac.S << endl;
	cout << bc.F << ' ' << bc.S << endl;
}
pair<int, pair<int, pair<int, int> > > Yeee(vector<point> v) {
	pair<int, pair<int, pair<int, int> > > ans = {0, {0, {0, 0}}};
		// cout << v.size() << endl;
	// for(auto it: v) cout << it << endl;
	int n = v.size();
	for(int i = 0; i < n; i ++) {
		// cout << i << endl;
		int ptr = (i + 1) % n;
		for(int j = 1; j < n; j ++) {
			while(cross(v[(i + j) % n] - v[i], v[(ptr + 1) % n] - v[ptr]) >= 0) {
				ptr = (ptr + 1) % n;
			}
			if(ptr == i) break;
			// cout << i << ' ' << (i + j) % n << ' ' << ptr << endl;
			#define MP make_pair
			ans = max(ans, MP(cross(v[(i + j) % n] - v[i], v[ptr] - v[i]), MP(i, MP((i + j) % n, ptr))));
		}
	}
	return ans;
}
main () {
	int n, s; cin >> n >> s;
	for(int i = 1; i <= n; i ++) {
		int x, y; cin >> x >> y;
		p[i] = {x, y};
	}
	vector<point> v = comvex_hull(n);
	pair<int, pair<int, pair<int, int> > > ans = {0, {0, {0, 0}}};
	ans = max(ans, Yeee(v));
	// cout << " AA  " << ans.first << ' ' << ans.second.first << ' ' << ans.second.second.first << ' ' << ans.second.second.second << endl;
	print(v[ans.second.first], v[ans.second.second.first], v[ans.second.second.second]);
}


#ifndef OCT_INSERT_PRE_DOCUMENT  // oct insert "pre-document"
#define OCT_INSERT_PRE_DOCUMENT
#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#endif
#include <bits/stdc++.h>
#define debug std::cerr << "Debug(" << __LINE__ << "): "
#define pub push_back
#define pob pop_back
#define pup push
#define mkp make_pair
#define fir first
#define sec second
#define ite iterator
#define lob lower_bound
#define upb upper_bound
#define reg register
using uint8 = unsigned char;
using uint16 = unsigned short int;
using uint32 = unsigned int;
using uint64 = unsigned long long;
using int8 = signed char;
using int16 = short int;
using int32 = int;
using int64 = long long;
using pi32 = std::pair<int32, int32>;
using pi64 = std::pair<int64, int64>;
namespace oct {
/* Array tn4 is the 4-direction changes in coordinate system.
 * The directions in order is {right, up, left, down}.
 */
const int tn4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const int tn8[8][2] = {{1, 0},  {1, 1},   {0, 1},  {-1, 1},
                       {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};
const double exp = 1e-8;
void sync(int pre = 8);
template <typename _Tp>
_Tp &mad(_Tp &x, _Tp y);
template <typename _Tp>
_Tp &mid(_Tp &x, _Tp y);
template <typename _Tp>
bool in(_Tp x, _Tp l, _Tp r);
template <typename _Tp>
_Tp sqr(_Tp x);
template <typename _Tp>
_Tp power(_Tp x, int64 m);
template <typename _Tp>
void sort(_Tp &x, _Tp &y);
template <typename _Tp1, typename _Tp2>
std::pair<_Tp1, _Tp2> operator+(std::pair<_Tp1, _Tp2> x,
                                std::pair<_Tp1, _Tp2> y);
template <typename _Tp>
_Tp &operator+=(_Tp &x, _Tp y);
inline void sync(int pre) {
    std::ios::sync_with_stdio(0);
    std::cin.tie(0), std::cout.tie(0);
    std::cout.flags(std::ios::fixed);
    std::cout.precision(pre);
    std::cout.setf(std::ios::showpoint);
}
template <typename _Tp>
inline _Tp &mad(_Tp &x, _Tp y) {
    return x = std::max(x, y);
}
template <typename _Tp>
inline _Tp &mid(_Tp &x, _Tp y) {
    return x = std::min(x, y);
}
template <typename _Tp>
inline bool in(_Tp x, _Tp l, _Tp r) {
    return l <= x && x <= r;
}
template <typename _Tp>
inline _Tp sqr(_Tp x) {
    return x * x;
}
template <typename _Tp>
inline _Tp power(_Tp x, int64 m) {
    return m == 1 ? x : (m & 1 ? power(x * x, m / 2) * x : power(x * x, m / 2));
}
template <typename _Tp>
inline void sort(_Tp &x, _Tp &y) {
    if (x > y) std::swap(x, y);
}
template <typename _Tp1, typename _Tp2>
inline std::pair<_Tp1, _Tp2> operator+(std::pair<_Tp1, _Tp2> x,
                                       std::pair<_Tp1, _Tp2> y) {
    return x.fir += y.fir, x.sec += y.sec, x;
}
template <typename _Tp>
_Tp &operator+=(_Tp &x, _Tp y) {
    return x = x + y;
}
}  // namespace oct

#endif  // oct end "pre-document"

#define rep(i, a, b) for (int i = a; i <= b; i++)
#define ll long long
#define RC rotating_calipers

using namespace std;

const int maxn = 100010;

struct point {
    ll x, y;
    point(ll x = 0, ll y = 0) : x(x), y(y) {}
    bool operator<(const point &c) const {
        return x < c.x || (x == c.x && y < c.y);
    }
    point operator-(const point &c) const { return point(x - c.x, y - c.y); }
};

ll det(point A, point B) { return A.x * B.y - A.y * B.x; }
ll det(point O, point A, point B) { return det(A - O, B - O); }

point a[maxn], ch[maxn], A, B, C;

void convexhull(int n, int &top) {
    sort(a + 1, a + n + 1);
    top = 0;
    for (int i = 1; i <= n; i++) {
        while (top > 1 && det(ch[top - 1], ch[top], a[i]) <= 0) top--;
        ch[++top] = a[i];
    }
    int ttop = top;
    for (int i = n - 1; i >= 1; i--) {
        while (top > ttop && det(ch[top - 1], ch[top], a[i]) <= 0) top--;
        ch[++top] = a[i];
    }
}
void rotating_calipers(point p[], int top) {
    ll ans = 0;
    int now;
    rep(i, 1, top - 2) {
        int now = i + 2;
        rep(j, i + 1, top - 1) {
            while (now <= top && abs(det(p[i], p[j], p[now])) <
                                     abs(det(p[i], p[j], p[now + 1]))) {
                now++;
            }
            ll tmp = abs(det(p[i], p[j], p[now]));
            if (tmp > ans) ans = tmp, A = p[i], B = p[j], C = p[now];
        }
    }
}
int main() {
    oct::sync();
    int N;
    ll S;
    std::cin >> N >> S;
    for (int i = 1; i <= N; i++) std::cin >> a[i].x >> a[i].y;
    int top;
    convexhull(N, top);
    RC(ch, top - 1);
    std::cout << A.x + B.x - C.x << ' ' << A.y + B.y - C.y << std::endl;
    std::cout << A.x + C.x - B.x << ' ' << A.y + C.y - B.y << std::endl;
    std::cout << B.x + C.x - A.x << ' ' << B.y + C.y - A.y << std::endl;
    return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (ll) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2
#define v(x) (ll)(x - 'a')

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const ll inf = numeric_limits <ll>::max() >> 1;
const ll N = 5001;
ll n, ans, ix, jx, kx;

struct Pt {
    ll x, y;

    ll det(const Pt &p) {
        return x * p.y - y * p.x;
    }

    ll ccw(const Pt &a, const Pt &b) const {
        Pt va = *this - a;
        Pt vb = *this - b;
        return va.det(vb);
    }
    Pt operator + (const Pt &p) const {
        return {x + p.x, y + p.y};
    }
    Pt operator - (const Pt &p) const {
        return {x - p.x, y - p.y};
    }
} pt[N];

vec <Pt> ch;

void input() {
    cin >> n;
    for(ll i = 0; i < n; ++i) {
        cin >> pt[i].x;
        cin >> pt[i].y;
    }
    sort(pt, pt + n, [](Pt x, Pt y) {
        return mp(x.y, x.x) < mp(y.y, y.x);
    });
}

vec <Pt> convex_hull() {
    vec <Pt> lower;
    vec <Pt> upper;
    lower.resize(2 * n);
    upper.resize(2 * n);
    ll j = 0;
    ll k = 0;
    for(ll i = 0; i < n; ++i) {
        while(j >= 2 && lower[j - 2].ccw(lower[j - 1], pt[i]) <= 0) {
            j--;
        }
        while(k >= 2 && upper[k - 2].ccw(upper[k - 1], pt[i]) >= 0) {
            k--;
        }
        lower[j++] = pt[i];
        upper[k++] = pt[i];
    }
    lower.resize(j);
    upper.resize(k);
    for(ll i = k - 2; i >= 1; --i) {
        lower.pb(upper[i]);
    }
    return lower;
}

ll area(Pt &a, Pt &b, Pt &c) {
    return abs(a.det(b) + b.det(c) + c.det(a));
}

void solve() {
    ch = convex_hull();
    n = len(ch);
    for(ll i = 0; i < n; ++i) {
        ll k = i + 1;
        for(ll j = i + 2; j != i; j = (j + 1) % n) {
            while(area(ch[i], ch[k + 1], ch[j]) > area(ch[i], ch[k], ch[j])) {
                k = (k + 1) % n;
            }
            ll res = area(ch[i], ch[k], ch[j]);
            if(res > ans) {
                ans = res;
                ix = i;
                jx = j;
                kx = k;
            }
        }
    }
    Pt a = ch[ix] + ch[jx] - ch[kx];
    Pt b = ch[ix] + ch[kx] - ch[jx];
    Pt c = ch[jx] + ch[kx] - ch[ix];
    cout << a.x << " " << a.y << "\n";
    cout << b.x << " " << b.y << "\n";
    cout << c.x << " " << c.y << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}

/*
9
3 1
6 1
8 4
8 6
5 6
2 6
1 2
3 4
5 3
*/


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (ll) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2
#define v(x) (ll)(x - 'a')

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const ll inf = numeric_limits <ll>::max() >> 1;
const ll N = 5001;
ll n, ans, ix, jx, kx;

struct Pt {
    ll x, y;

    ll det(const Pt &p) {
        return x * p.y - y * p.x;
    }

    ll ccw(const Pt &a, const Pt &b) const {
        Pt va = *this - a;
        Pt vb = *this - b;
        return va.det(vb);
    }
    Pt operator + (const Pt &p) const {
        return {x + p.x, y + p.y};
    }
    Pt operator - (const Pt &p) const {
        return {x - p.x, y - p.y};
    }
} pt[N];

vec <Pt> ch;

void input() {
    cin >> n;
    for(ll i = 0; i < n; ++i) {
        cin >> pt[i].x;
        cin >> pt[i].y;
    }
    sort(pt, pt + n, [](Pt x, Pt y) {
        return mp(x.y, x.x) < mp(y.y, y.x);
    });
}

vec <Pt> convex_hull() {
    vec <Pt> lower;
    vec <Pt> upper;
    lower.resize(2 * n);
    upper.resize(2 * n);
    ll j = 0;
    ll k = 0;
    for(ll i = 0; i < n; ++i) {
        while(j >= 2 && lower[j - 2].ccw(lower[j - 1], pt[i]) <= 0) {
            j--;
        }
        while(k >= 2 && upper[k - 2].ccw(upper[k - 1], pt[i]) >= 0) {
            k--;
        }
        lower[j++] = pt[i];
        upper[k++] = pt[i];
    }
    lower.resize(j);
    upper.resize(k);
    for(ll i = k - 2; i >= 1; --i) {
        lower.pb(upper[i]);
    }
    return lower;
}

ll area(Pt &a, Pt &b, Pt &c) {
    return abs(a.det(b) + b.det(c) + c.det(a));
}

void solve() {
    ch = convex_hull();
    n = len(ch);
    for(ll i = 0; i < n; ++i) {
        ll k = i + 1;
        for(ll j = i + 2; j != i; j = (j + 1) % n) {
            while(area(ch[i], ch[k + 1], ch[j]) > area(ch[i], ch[k], ch[j])) {
                k = (k + 1) % n;
            }
            ll res = area(ch[i], ch[k], ch[j]);
            if(res > ans) {
                ans = res;
                ix = i;
                jx = j;
                kx = k;
            }
        }
    }
    Pt a = ch[ix] + ch[jx] - ch[kx];
    Pt b = ch[ix] + ch[kx] - ch[jx];
    Pt c = ch[jx] + ch[kx] - ch[ix];
    if(n > 10) {
        cout << ans << " -- " << area(a, b, c) << "\n";
    }
    cout << a.x << " " << a.y << "\n";
    cout << b.x << " " << b.y << "\n";
    cout << c.x << " " << c.y << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}

/*
9
3 1
6 1
8 4
8 6
5 6
2 6
1 2
3 4
5 3
*/


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (ll) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2
#define v(x) (ll)(x - 'a')

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const ll inf = numeric_limits <ll>::max() >> 1;
const ll N = 5001;
ll n, s, ans, ix, jx, kx;

struct Pt {
    ll x, y;

    ll det(const Pt &p) {
        return x * p.y - y * p.x;
    }

    ll ccw(const Pt &a, const Pt &b) const {
        Pt va = *this - a;
        Pt vb = *this - b;
        return va.det(vb);
    }
    Pt operator + (const Pt &p) const {
        return {x + p.x, y + p.y};
    }
    Pt operator - (const Pt &p) const {
        return {x - p.x, y - p.y};
    }
} pt[N];

vec <Pt> ch;

void input() {
    cin >> n >> s;
    for(ll i = 0; i < n; ++i) {
        cin >> pt[i].x;
        cin >> pt[i].y;
    }
    sort(pt, pt + n, [](Pt x, Pt y) {
        return mp(x.y, x.x) < mp(y.y, y.x);
    });
}

vec <Pt> convex_hull() {
    vec <Pt> lower;
    vec <Pt> upper;
    lower.resize(2 * n);
    upper.resize(2 * n);
    ll j = 0;
    ll k = 0;
    for(ll i = 0; i < n; ++i) {
        while(j >= 2 && lower[j - 2].ccw(lower[j - 1], pt[i]) <= 0) {
            j--;
        }
        while(k >= 2 && upper[k - 2].ccw(upper[k - 1], pt[i]) >= 0) {
            k--;
        }
        lower[j++] = pt[i];
        upper[k++] = pt[i];
    }
    lower.resize(j);
    upper.resize(k);
    for(ll i = k - 2; i >= 1; --i) {
        lower.pb(upper[i]);
    }
    return lower;
}

ll area(Pt &a, Pt &b, Pt &c) {
    return abs(a.det(b) + b.det(c) + c.det(a));
}

void solve() {
    ch = convex_hull();
    n = len(ch);
    for(ll i = 0; i < n; ++i) {
        ll k = i + 1;
        for(ll j = i + 2; j != i; j = (j + 1) % n) {
            while(area(ch[i], ch[k + 1], ch[j]) > area(ch[i], ch[k], ch[j])) {
                k = (k + 1) % n;
            }
            ll res = area(ch[i], ch[k], ch[j]);
            if(res > ans) {
                ans = res;
                ix = i;
                jx = j;
                kx = k;
            }
        }
    }
    Pt a = ch[ix] + ch[jx] - ch[kx];
    Pt b = ch[ix] + ch[kx] - ch[jx];
    Pt c = ch[jx] + ch[kx] - ch[ix];
    cout << a.x << " " << a.y << "\n";
    cout << b.x << " " << b.y << "\n";
    cout << c.x << " " << c.y << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}

/*
9
3 1
6 1
8 4
8 6
5 6
2 6
1 2
3 4
5 3
*/


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (ll) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2
#define v(x) (ll)(x - 'a')

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const ll inf = numeric_limits <ll>::max() >> 1;
const ll N = 5001;
ll n, s, ans, ix, jx, kx;

struct Pt {
    ll x, y;

    ll det(const Pt &p) {
        return x * p.y - y * p.x;
    }

    ll ccw(const Pt &a, const Pt &b) const {
        Pt va = *this - a;
        Pt vb = *this - b;
        return va.det(vb);
    }
    Pt operator + (const Pt &p) const {
        return {x + p.x, y + p.y};
    }
    Pt operator - (const Pt &p) const {
        return {x - p.x, y - p.y};
    }
} pt[N];

vec <Pt> ch;

void input() {
    cin >> n >> s;
    for(ll i = 0; i < n; ++i) {
        cin >> pt[i].x;
        cin >> pt[i].y;
    }
    sort(pt, pt + n, [](Pt x, Pt y) {
        return mp(x.y, x.x) < mp(y.y, y.x);
    });
}

vec <Pt> convex_hull() {
    vec <Pt> lower;
    vec <Pt> upper;
    lower.resize(2 * n);
    upper.resize(2 * n);
    ll j = 0;
    ll k = 0;
    for(ll i = 0; i < n; ++i) {
        while(j >= 2 && lower[j - 2].ccw(lower[j - 1], pt[i]) <= 0) {
            j--;
        }
        while(k >= 2 && upper[k - 2].ccw(upper[k - 1], pt[i]) >= 0) {
            k--;
        }
        lower[j++] = pt[i];
        upper[k++] = pt[i];
    }
    lower.resize(j);
    upper.resize(k);
    for(ll i = k - 2; i >= 1; --i) {
        lower.pb(upper[i]);
    }
    return lower;
}

ll area(Pt &a, Pt &b, Pt &c) {
    return abs(a.det(b) + b.det(c) + c.det(a));
}

int next(int x) {
    return (x + 1) == n? 0: x + 1;
}

void solve() {
    ch = convex_hull();
    n = len(ch);
    for(ll i = 0; i < n; ++i) {
        ll k = next(i);
        for(ll j = next(next(i)); j != i; j = next(j)) {
            while(area(ch[i], ch[next(k)], ch[j]) > area(ch[i], ch[k], ch[j])) {
                k = next(k);
            }
            ll res = area(ch[i], ch[k], ch[j]);
            if(res > ans) {
                ans = res;
                ix = i;
                jx = j;
                kx = k;
            }
        }
    }
    Pt a = ch[ix] + ch[jx] - ch[kx];
    Pt b = ch[ix] + ch[kx] - ch[jx];
    Pt c = ch[jx] + ch[kx] - ch[ix];
    cout << a.x << " " << a.y << "\n";
    cout << b.x << " " << b.y << "\n";
    cout << c.x << " " << c.y << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}

/*
9 1
3 1
6 1
8 4
8 6
5 6
2 6
1 2
3 4
5 3
*/


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/priority_queue.hpp>
//#pragma GCC optimize("O3")
//#pragma GCC target("sse4")
//#pragma GCC target("avx2")

#define deb(x) cout << #x << " = " << x << "\n"
#define all(x) (x).begin(), (x).end()
#define len(x) (ll) x.size()
#define lsb(x) (x) & -(x)
#define l(x) (x << 1) + 1
#define r(x) (x << 1) + 2
#define v(x) (ll)(x - 'a')

#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
typedef pair <ld, ld> pld;
typedef pair <ll, ll> pll;

template <class T1, class T2 = less <T1>> using pb_heap = __gnu_pbds::priority_queue <T1, T2, binary_heap_tag>;
template <class T1, class T2 = null_type, class T3 = less <T1>> using pb_map = tree <T1, T2, T3, rb_tree_tag, tree_order_statistics_node_update>;
template <class T1, class T2 = null_type, class T3 = hash <T1>> using pb_umap = gp_hash_table <T1, T2, T3>;
template <class T1, class T2, class T3 = hash <T1>> using umap = unordered_map <T1, T2, T3>;
template <class T> using uset = unordered_set <T>;
template <class T> using vec = vector <T>;

const ll infll = numeric_limits <ll>::max() >> 1;
const ll inf = numeric_limits <ll>::max() >> 1;
const ll N = 5001;
ll n, s, ans, ix, jx, kx;

struct Pt {
    ll x, y;

    ll det(const Pt &p) {
        return x * p.y - y * p.x;
    }

    ll ccw(const Pt &a, const Pt &b) const {
        Pt va = *this - a;
        Pt vb = *this - b;
        return va.det(vb);
    }
    Pt operator + (const Pt &p) const {
        return {x + p.x, y + p.y};
    }
    Pt operator - (const Pt &p) const {
        return {x - p.x, y - p.y};
    }
} pt[N];

vec <Pt> ch;

void input() {
    cin >> n >> s;
    for(ll i = 0; i < n; ++i) {
        cin >> pt[i].x;
        cin >> pt[i].y;
    }
    sort(pt, pt + n, [](Pt x, Pt y) {
        return mp(x.y, x.x) < mp(y.y, y.x);
    });
}

vec <Pt> convex_hull() {
    vec <Pt> lower;
    vec <Pt> upper;
    lower.resize(2 * n);
    upper.resize(2 * n);
    ll j = 0;
    ll k = 0;
    for(ll i = 0; i < n; ++i) {
        while(j >= 2 && lower[j - 2].ccw(lower[j - 1], pt[i]) <= 0) {
            j--;
        }
        while(k >= 2 && upper[k - 2].ccw(upper[k - 1], pt[i]) >= 0) {
            k--;
        }
        lower[j++] = pt[i];
        upper[k++] = pt[i];
    }
    lower.resize(j);
    upper.resize(k);
    for(ll i = k - 2; i >= 1; --i) {
        lower.pb(upper[i]);
    }
    return lower;
}

ll area(Pt &a, Pt &b, Pt &c) {
    return abs(a.det(b) + b.det(c) + c.det(a));
}

void solve() {
    ch = convex_hull();
    n = len(ch);
    for(ll i = 0; i < n; ++i) {
        ll k = i + 1;
        for(ll j = i + 2; j != i; j = (j + 1) % n) {
            while(area(ch[i], ch[k + 1], ch[j]) > area(ch[i], ch[k], ch[j])) {
                k = (k + 1) % n;
            }
            ll res = area(ch[i], ch[k], ch[j]);
            if(res > ans) {
                ans = res;
                ix = i;
                jx = j;
                kx = k;
            }
        }
    }
    Pt a = ch[ix] + ch[jx] - ch[kx];
    Pt b = ch[ix] + ch[kx] - ch[jx];
    Pt c = ch[jx] + ch[kx] - ch[ix];
    if(n > 10) {
        cout << ans << " -- " << area(a, b, c) << "\n";
    }
    cout << a.x << " " << a.y << "\n";
    cout << b.x << " " << b.y << "\n";
    cout << c.x << " " << c.y << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    input();
    solve();
}

/*
9
3 1
6 1
8 4
8 6
5 6
2 6
1 2
3 4
5 3
*/


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

#pragma 03

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define gcd __gcd
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define rep(i, n) for (int i=0; i<(n); i++)
#define rep1(i, n) for (int i=1; i<=(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned uint;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
template<typename _def> using ordered_set=tree<_def, null_type, less<_def>, rb_tree_tag, tree_order_statistics_node_update>;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;

using pt=pair<ld, ld>;
#define x fi
#define y se

bool cw(pt a, pt b, pt c) {
    return a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y)<0;
}

bool ccw(pt a, pt b, pt c) {
    return a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y)>0;
}

void make_convex_hull(vector<pt>& a) {
    //cp-algo graham's scan
    if (a.size()==1) return;
    sort(all(a));
    pt p1=a[0], p2=a.back();
    vector<pt> up, down;
    up.pb(p1); down.pb(p1);
    rep1(i, a.size()-1) {
        if (i==a.size()-1||cw(p1, a[i], p2)) {
            while (up.size()>=2&&!cw(up[up.size()-2], up[up.size()-1], a[i])) up.pop_back();
            up.pb(a[i]);
        }
        if (i==a.size()-1||ccw(p1, a[i], p2)) {
            while(down.size()>=2&&!ccw(down[down.size()-2], down[down.size()-1], a[i])) down.pop_back();
            down.pb(a[i]);
        }
    }
    a.clear();
    for (int i=0; i<up.size(); i++) a.pb(up[i]);
    for (int i=down.size()-2; i>0; i--) a.pb(down[i]);
}

ld area(pt a, pt b, pt c) {
    return abs(a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y))/2;
}

tuple<pt, pt, pt> find_largest_rectangle(vector<pt>& a) {
    const int n=a.size();
    int A=0, B=1, C=2;
    int bA=A, bB=B, bC=C;
    while(1) {
        while(1) {
            while(area(a[A], a[B], a[C])<area(a[A], a[B], a[(C+1)%n])) C=(C+1)%n;
            if(area(a[A], a[B], a[C])<area(a[A], a[(B+1)%n], a[C])) B=(B+1)%n;
            else break;
        }
        if(area(a[A], a[B], a[C])>area(a[bA], a[bB], a[bC])) bA=A, bB=B, bC=C;
        A=(A+1)%n;
        if (A==B) B=(B+1)%n;
        if (B==C) C=(C+1)%n;
        if (A==0) break;
    }
    return make_tuple(a[bA], a[bB], a[bC]);
}

tuple<pt, pt, pt> refl(tuple<pt, pt, pt> a) {
    pt x, y, z;
    tie(x, y, z)=a;
    return make_tuple(mp(x.x+y.x-z.x, x.y+y.y-z.y), mp(x.x-y.x+z.x, x.y-y.y+z.y), mp(-x.x+y.x+z.x, -x.y+y.y+z.y));
}

int32_t main() {
    int n; ld S; cin>>n>>S;
    vector<pt> a(n); rep(i, n) cin>>a[i].x>>a[i].y;
    make_convex_hull(a);
    auto it=refl(find_largest_rectangle(a));
    pt x, y, z; tie(x, y, z)=it;
    cout<<x.fi<<' '<<x.se<<endl<<y.fi<<' '<<y.se<<endl<<z.fi<<' '<<z.se<<endl;
}


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

#pragma 03

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

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define gcd __gcd
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define rep(i, n) for (int i=0; i<(n); i++)
#define rep1(i, n) for (int i=1; i<=(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl "\n"

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned uint;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
template<typename _def> using ordered_set=tree<_def, null_type, less<_def>, rb_tree_tag, tree_order_statistics_node_update>;
typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;

using pt=pii;
#define x fi
#define y se

bool cw(pt a, pt b, pt c) {
    return a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y)<0;
}

bool ccw(pt a, pt b, pt c) {
    return a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y)>0;
}

void make_convex_hull(vector<pt>& a) {
    //cp-algo graham's scan
    if (a.size()==1) return;
    sort(all(a));
    pt p1=a[0], p2=a.back();
    vector<pt> up, down;
    up.pb(p1); down.pb(p1);
    rep1(i, a.size()-1) {
        if (i==a.size()-1||cw(p1, a[i], p2)) {
            while (up.size()>=2&&!cw(up[up.size()-2], up[up.size()-1], a[i])) up.pop_back();
            up.pb(a[i]);
        }
        if (i==a.size()-1||ccw(p1, a[i], p2)) {
            while(down.size()>=2&&!ccw(down[down.size()-2], down[down.size()-1], a[i])) down.pop_back();
            down.pb(a[i]);
        }
    }
    a.clear();
    for (int i=0; i<up.size(); i++) a.pb(up[i]);
    for (int i=down.size()-2; i>0; i--) a.pb(down[i]);
}

ld area(pt a, pt b, pt c) {
    return abs(a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y));
}

tuple<pt, pt, pt> find_largest_rectangle(vector<pt>& a) {
    const int n=a.size();
    int A=0, B=1, C=2;
    int bA=A, bB=B, bC=C;
    while(1) {
        while(1) {
            while(area(a[A], a[B], a[C])<area(a[A], a[B], a[(C+1)%n])) C=(C+1)%n;
            if(area(a[A], a[B], a[C])<area(a[A], a[(B+1)%n], a[C])) B=(B+1)%n;
            else break;
        }
        if(area(a[A], a[B], a[C])>area(a[bA], a[bB], a[bC])) bA=A, bB=B, bC=C;
        A=(A+1)%n;
        if (A==B) B=(B+1)%n;
        if (B==C) C=(C+1)%n;
        if (A==0) break;
    }
    return make_tuple(a[bA], a[bB], a[bC]);
}

tuple<pt, pt, pt> refl(tuple<pt, pt, pt> a) {
    pt x, y, z;
    tie(x, y, z)=a;
    return make_tuple(mp(x.x+y.x-z.x, x.y+y.y-z.y), mp(x.x-y.x+z.x, x.y-y.y+z.y), mp(-x.x+y.x+z.x, -x.y+y.y+z.y));
}

int32_t main() {
    int n, S; cin>>n>>S;
    vector<pt> a(n); rep(i, n) cin>>a[i].x>>a[i].y;
    make_convex_hull(a);
    auto it=refl(find_largest_rectangle(a));
    pt x, y, z; tie(x, y, z)=it;
    cout<<x.fi<<' '<<x.se<<endl<<y.fi<<' '<<y.se<<endl<<z.fi<<' '<<z.se<<endl;
}