水到掉渣
#include <stdio.h>
#include <string.h>
char buf[300];
int main(void){
unsigned int i, len;
unsigned int sum;
//freopen("input.dat", "r", stdin);
while(1){
gets(buf);
if('#' == buf[0])
break;
len = strlen(buf);
for(i=0,sum=0; i<len; i++){
if(' ' == buf[i])
continue;
sum += (unsigned int)(buf[i]-'A'+1)*(1+i);
}
printf("%u\n", sum);
}
return 0;
}