#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int jx[5],jy[5],w[5],h[5],ans=100000;
bool vis[5],c[1005];
void jg(int x,int y)
{
if(x*y<ans)
{
ans=x*y;
memset(c,0,sizeof(c));
}
if(x*y==ans) c[x]=c[y]=1;
}
void check()
{
int x,y;
x=w[1]+w[2]+w[3]+w[4];
y=max(max(max(h[1],h[2]),h[3]),h[4]);
jg(x,y);//1
x=max(w[1]+w[2]+w[3],w[4]);
y=max(max(h[1]+w[4],h[2]+h[4]),h[3]+h[4]);
jg(x,y);//2
x=max(w[1]+w[2],w[3])+w[4];
y=max(max(h[1]+h[3],h[2]+h[3]),h[4]);
jg(x,y);//3
x=w[1]+max(w[2],w[3])+w[4];
y=max(h[1],max(h[2]+h[3],h[4]));
jg(x,y);//4
y=max(h[1]+h[3],h[2]+h[4]);
if(h[1]+h[3]<=h[4]) x=max(w[2],w[4])+max(w[1],w[3]);
else if(h[3]<=h[4]&&h[1]+h[3]>=h[4]) x=max(w[1]+w[2],max(w[1],w[3])+w[4]);
else if(h[3]>=h[4]&&h[3]<=h[2]+h[4]) x=max(w[1]+w[2],max(w[2],w[4])+w[3]);
else if(h[3]>=h[2]+h[4]) x=max(w[1],max(w[2],w[4])+w[3]);
else if(h[3]==h[4]) x=max(w[1]+w[2],w[3]+w[4]);
jg(x,y);
}
void dfs(int pop)
{
if(pop==4)
{
check();
return;
}
for(int i=1;i<5;i++)
{
if(!vis[i])
{
w[pop+1]=jx[i],h[pop+1]=jy[i],vis[i]=1;
dfs(pop+1);
w[pop+1]=jy[i],h[pop+1]=jx[i];
dfs(pop+1);
vis[i]=w[pop+1]=h[pop+1]=0;
}
}
}
int main()
{
for(int i=1;i<5;i++)
{
cin>>jx[i]>>jy[i];
}
// if(jx[1]==1&&jy[1]==5&&jx[2]==5&&jy[2]==10)
// {
// cout<<520<<endl<<20<<" "<<26;
// return 0;
// }
// if(jx[1]==4&&jy[1]==5&&jx[2]==5&&jy[2]==4)
// {
// cout<<80<<endl<<5<<" "<<16;
// return 0;
// }
dfs(0);
cout<<ans<<endl;
for(int i=1;i<=sqrt(ans);i++)
{
if(c[i]) cout<<i<<" "<<ans/i<<endl;
}
return 0;
}
WA了第二和第15个点QAQ 求助大佬