#include <iostream>
using namespace std;
int main()
{
int n,i=0;
cin>>n;
while(n>0)
{
i++;
int a,b,time=0;
cin>>a>>b;
if(a!=b) ///lift come to my position
{
int me=a;
int lft=b;
if(a>b)
{
int j=a-b;
j *=4;
time +=j;
}
else
{
int j=b-a;
j *=4;
time +=j;
}
}
time +=11;/// 3 + 5 +3; ///door open + close + entry in lift
int j = a*4; ///total floor to go
time +=j;
time +=8; ///exit + door open
cout<<"Case "<<i<<": "<<time<<endl;
n--;
}
return 0;
}
Add your comment