


"""simple docstring"""






lowercase  		=			{
    """A""": ("""ABCDEFGHIJKLM""", """NOPQRSTUVWXYZ"""),
    """B""": ("""ABCDEFGHIJKLM""", """NOPQRSTUVWXYZ"""),
    """C""": ("""ABCDEFGHIJKLM""", """ZNOPQRSTUVWXY"""),
    """D""": ("""ABCDEFGHIJKLM""", """ZNOPQRSTUVWXY"""),
    """E""": ("""ABCDEFGHIJKLM""", """YZNOPQRSTUVWX"""),
    """F""": ("""ABCDEFGHIJKLM""", """YZNOPQRSTUVWX"""),
    """G""": ("""ABCDEFGHIJKLM""", """XYZNOPQRSTUVW"""),
    """H""": ("""ABCDEFGHIJKLM""", """XYZNOPQRSTUVW"""),
    """I""": ("""ABCDEFGHIJKLM""", """WXYZNOPQRSTUV"""),
    """J""": ("""ABCDEFGHIJKLM""", """WXYZNOPQRSTUV"""),
    """K""": ("""ABCDEFGHIJKLM""", """VWXYZNOPQRSTU"""),
    """L""": ("""ABCDEFGHIJKLM""", """VWXYZNOPQRSTU"""),
    """M""": ("""ABCDEFGHIJKLM""", """UVWXYZNOPQRST"""),
    """N""": ("""ABCDEFGHIJKLM""", """UVWXYZNOPQRST"""),
    """O""": ("""ABCDEFGHIJKLM""", """TUVWXYZNOPQRS"""),
    """P""": ("""ABCDEFGHIJKLM""", """TUVWXYZNOPQRS"""),
    """Q""": ("""ABCDEFGHIJKLM""", """STUVWXYZNOPQR"""),
    """R""": ("""ABCDEFGHIJKLM""", """STUVWXYZNOPQR"""),
    """S""": ("""ABCDEFGHIJKLM""", """RSTUVWXYZNOPQ"""),
    """T""": ("""ABCDEFGHIJKLM""", """RSTUVWXYZNOPQ"""),
    """U""": ("""ABCDEFGHIJKLM""", """QRSTUVWXYZNOP"""),
    """V""": ("""ABCDEFGHIJKLM""", """QRSTUVWXYZNOP"""),
    """W""": ("""ABCDEFGHIJKLM""", """PQRSTUVWXYZNO"""),
    """X""": ("""ABCDEFGHIJKLM""", """PQRSTUVWXYZNO"""),
    """Y""": ("""ABCDEFGHIJKLM""", """OPQRSTUVWXYZN"""),
    """Z""": ("""ABCDEFGHIJKLM""", """OPQRSTUVWXYZN"""),
}



def 			A__		(					_UpperCAmelCase    :      str	)							->	list[tuple[str, str]]:

	'''simple docstring'''


	return [alphabet[char] for char in key.upper()]



def 			A__		(					_UpperCAmelCase    :      str				,    _UpperCAmelCase    :      str	)							->	str:

	'''simple docstring'''


	snake_case__  :						Tuple		=      ""
	snake_case__  :						Dict		=      0
	snake_case__  :						List[str]		=      generate_table(_UpperCAmelCase	)
	for char in words.upper():
		cipher += get_opponent(table[count]				,    _UpperCAmelCase	)
		snake_case__  :						List[Any]		=      (count + 1) % len(_UpperCAmelCase	)
	return cipher



def 			A__		(					_UpperCAmelCase    :      str				,    _UpperCAmelCase    :      str	)							->	str:

	'''simple docstring'''


	return encrypt(_UpperCAmelCase				,    _UpperCAmelCase	)



def 			A__		(					_UpperCAmelCase    :      tuple[str, str]				,    _UpperCAmelCase    :      str	)							->	tuple[int, int]:

	'''simple docstring'''


	snake_case__  :						List[Any]		=      0 if char in table[0] else 1
	snake_case__  :						List[Any]		=      table[row].index(_UpperCAmelCase	)
	return row, col



def 			A__		(					_UpperCAmelCase    :      tuple[str, str]				,    _UpperCAmelCase    :      str	)							->	str:

	'''simple docstring'''


	snake_case__,					snake_case__  :						Union[str, Any]		=      get_position(_UpperCAmelCase				,    char.upper()	)
	if row == 1:
		return table[0][col]
	else:
		return table[1][col] if row == 0 else char


if __name__ == "__main__":
					import doctest

					doctest.testmod()  # Fist ensure that all our tests are passing...
					lowercase  		=			input("""Enter key: """).strip()
					lowercase  		=			input("""Enter text to encrypt: """).strip()
					lowercase  		=			encrypt(key, text)

					print(f"Encrypted: {cipher_text}")
					print(f"Decrypted with key: {decrypt(key, cipher_text)}")












'''simple docstring'''






def 				_lowerCamelCase(	UpperCamelCase__     :			int = 1_000		)		->	int:
    A							:							Optional[Any]				=    [0, 3, 3, 5, 4, 4, 3, 5, 5, 4, 3, 6, 6, 8, 8, 7, 7, 9, 8, 8]
    # number of letters in twenty, thirty, ..., ninety (0 for numbers less than
    # 20 due to inconsistency in teens)
    A							:							Tuple				=    [0, 0, 6, 6, 5, 5, 5, 7, 6, 6]

    A							:							str				=    0

    for i in range(1     ,							n + 1		):
        if i < 1_000:
            if i >= 100:
                # add number of letters for "n hundred"
                count += ones_counts[i // 100] + 7

                if i % 100 != 0:
                    # add number of letters for "and" if number is not multiple
                    # of 100
                    count += 3

            if 0 < i % 100 < 20:
                # add number of letters for one, two, three, ..., nineteen
                # (could be combined with below if not for inconsistency in
                # teens)
                count += ones_counts[i % 100]
            else:
                # add number of letters for twenty, twenty one, ..., ninety
                # nine
                count += ones_counts[i % 10]
                count += tens_counts[(i % 100 - i % 10) // 10]
        else:
            count += ones_counts[i // 1_000] + 8
    return count


if __name__ == "__main__":
     print(solution(int(input().strip())))
