var
	s: string;
	ans, i, mul : integer;
begin
	assign(input, 'h2o.in');
	reset(input);
	assign(output, 'h2o.out');
	rewrite(output);
	readln(s);
	assert(length(s) <= 20);
	ans := 0;
	for i := 1 to length(s) do begin
		assert((s[i] in ['H','O','N','C']) or (s[i] in ['1'..'9']));
		if s[i] in ['1'..'9'] then begin
			assert(s[i - 1] in ['H','O','N','C']);
			continue;
		end;
		mul := 1;
		if (i + 1 <= length(s)) and (s[i + 1] in ['1'..'9']) then begin
			mul := ord(s[i + 1]) - ord('0');
		end;
		case s[i] of 
			'H': ans := ans + mul;
			'O': ans := ans + mul * 16;
			'C': ans := ans + mul * 12;
			'N': ans := ans + mul * 14;
		end;
	end;
	writeln(ans);
	close(input);
	close(output);
end.