#P2108. English Number Conversion

    ID: 15390 Type: Default 1000ms 256MiB

English Number Conversion

English Number Conversion

Little Z, keen on math and determined to master English cardinal numbers, has prepared some problems. Given the English textual representation of an integer x, your task is to output the corresponding Arabic numeral. The input follows these rules:

  • -999,999,999 ≤ x ≤ 999,999,999
  • The only words used are: negative, zero, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, thirty, forty, fifty, sixty, seventy, eighty, ninety, hundred, thousand, million
  • If x is negative, the first word will be negative; otherwise, this word will not appear.
  • Note that although proper English (e.g. for 103, one would say "one hundred and three") includes the word and, Little Z omits it. For instance, 103 is given as "one hundred three".
  • The rest of the format follows standard English grammar. For example, 1500 is written as "one thousand five hundred" (not "fifteen hundred").

Your program should correctly parse the provided English phrase and output the corresponding integer.

inputFormat

A single line containing the English representation of the integer x.

outputFormat

Output the corresponding Arabic numeral as an integer.

sample

zero
0