#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
#include<string.h>
#include<stdio.h>
using namespace std;
int main()
{
char str[256];
int a[100], i = 0, j = 0, x = 0, l=0;
while (gets_s(str) && str[0] != '#')
{
l = strlen(str);
for (i = 0; i < l; i++)
{
if (str[i] >= 'A'&&str[i] <= 'Z')
x = x + (i+1)*(str[i] - 'A' + 1);
}
a[j++] = x;
x = 0;
}
for (i = 0; i < j; i++)
cout << a[i] << endl;
{
char str[256];
int a[100], i = 0, j = 0, x = 0, l=0;
while (gets_s(str) && str[0] != '#')
{
l = strlen(str);
for (i = 0; i < l; i++)
{
if (str[i] >= 'A'&&str[i] <= 'Z')
x = x + (i+1)*(str[i] - 'A' + 1);
}
a[j++] = x;
x = 0;
}
for (i = 0; i < j; i++)
cout << a[i] << endl;
system("pause");
return 0;
}
return 0;
}