#include <iostream>
using namespace std;
int main() {
int a[10], i, sum = 0;
for (i = 0; i <= 9; i++) {
cin >> a[i];
a[i] += (i + 1);
}
for (i = 9; i >= 0; i--) {
cout << a[i] << " ";
}
for (i = 0; i <= 9; i++) {
sum += a[i];
}
cout << endl << sum;
return 0;
}