program i;


function process_line(s: string): longint;
var
	buf: longint;
	res: longint;
	neg: boolean;
	n: integer;
	one: string;
begin
	neg := false;
	buf := 0;
	res := 0;
	
	s:=s+' ';
	while s<>'' do begin
		n := pos(' ', s);
		one:=copy(s, 1, n-1);
		delete(s, 1, n);
		{writeln(':::', one,':::');}
		if one='negative' then neg := true
		else if one='zero' then buf:=buf+0
		else if one='one' then buf:=buf+1
		else if one='two' then buf:=buf+2
		else if one='three' then buf:=buf+3
		else if one='four' then buf:=buf+4
		else if one='five' then buf:=buf+5
		else if one='six' then buf:=buf+6
		else if one='seven' then buf:=buf+7
		else if one='eight' then buf:=buf+8
		else if one='nine' then buf:=buf+9
		else if one='ten' then buf:=buf+10
		else if one='eleven' then buf:=buf+11
		else if one='twelve' then buf:=buf+12
		else if one='thirteen' then buf:=buf+13
		else if one='fourteen' then buf:=buf+14
		else if one='fifteen' then buf:=buf+15
		else if one='sixteen' then buf:=buf+16
		else if one='seventeen' then buf:=buf+17
		else if one='eighteen' then buf:=buf+18
		else if one='nineteen' then buf:=buf+19
		else if one='twenty' then buf:=buf+20
		else if one='thirty' then buf:=buf+30
		else if one='forty' then buf:=buf+40
		else if one='fifty' then buf:=buf+50
		else if one='sixty' then buf:=buf+60
		else if one='seventy' then buf:=buf+70
		else if one='eighty' then buf:=buf+80
		else if one='ninety' then buf:=buf+90
		else if one='hundred' then buf:=buf*100
		else if one='thousand' then begin res:=res+buf*1000; buf:=0; end
		else if one='million' then begin res:=res+buf*1000000; buf:=0; end
		else writeln('[nerozponano:', one, ']');
	end;
	res := res+buf;
	if neg then res := -res;
	process_line := res;
end;



var
	s: string;
begin
while true do begin
	readln(s);
	if s='' then break;
	writeln(process_line(s));
end;
end.
