#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int x1, x2, x3, x5, x8, y1, y2, y3, y5, y8;
double max = 0.0, result;
for (x8 = 0; x8 <= 2; x8++) {
for (x5 = 0; x5 <= (20 - 8 * x8) / 5;x5++) {
for (x3 = 0; x3 <= (20 - 8 * x8-5*x5) / 3; x3++) {
for (x2 = 0; x2 <= (20 - 8 * x8 - 5 * x5 - 3 * x3) / 2; x2++) {
x1 = 20 - 8 * x8 - 5 * x5 - 3 * x3 - 2 * x2;
result = 2000 * pow((1 + 0.0063 * 12), x1) * pow((1 + 2 * 0.0066 * 12), x2) * pow((1 + 3 * 12 * 0.0069), x3) * pow((1 + 5 * 12 * 0.0075), x5) * pow((1 + 8 * 0.0084 * 12), x8);
if (result > max) {
max = result;
y1 = x1;
y2 = x2;
y3 = x3;
y5 = x5;
y8 = x8;
}
}
}
}
}
cout << y8 << " " << y5 << " " << y3 << " " << y2 << " " << " " << y1 << " " << result;
return 0;
}