#include<bits/stdc++.h>
using namespace std;
int main() {
double a,b,c,d,e,l1,l2,l3;
int x,y;
cin>>a>>b>>c>>d>>e>>x>>y;
l1=((a*x)+(b*y))*1.0;
l2=(c*y)*1.0;
l3=(d*y+e)*1.0;
if (l1>l2&&l1>l3){
cout<<1<<" ";
cout<<fixed<<setprecision(2)<<l1;
};
if(l2>l1&&l2>l3){
cout<<2<<" ";
cout<<fixed<<setprecision(2)<<l2;
};
if(l3>l2&&l3>l1){
cout<<3<<" ";
cout<<fixed<<setprecision(2)<<l3;
};
if(l1==l2||l1==l3||l2==l3||l1==l2&&l1==l3){
cout<<1<<" ";
cout<<fixed<<setprecision(2)<<l1;
};
return 0;
}