





import qiskit
from qiskit.providers import Backend

def     UpperCAmelCase_						(						_UpperCAmelCase       :int     ,	_UpperCAmelCase       :int							)  ->							tuple[qiskit.QuantumCircuit, str, str]:
     '''simple docstring'''


     A_      ,						A_					      =  bin(_UpperCAmelCase							)[2:], bin(_UpperCAmelCase							)[2:]  # Remove leading '0b'

     # Ensure that both strings are of the same length
     if len(_UpperCAmelCase							) > len(_UpperCAmelCase							):
          A_					      =  y.zfill(len(_UpperCAmelCase							)							)
     else:
          A_					      =  x.zfill(len(_UpperCAmelCase							)							)

     # We need (3 * number of bits in the larger number)+1 qBits
     # The second parameter is the number of classical registers, to measure the result
     A_					      =  qiskit.QuantumCircuit((len(_UpperCAmelCase							) * 3) + 1     ,	len(_UpperCAmelCase							) + 1							)

     # We are essentially "not-ing" the bits that are 1
     # Reversed because it's easier to perform ops on more significant bits
     for i in range(len(_UpperCAmelCase							)							):
          if x[::-1][i] == "1":
               circuit.x(_UpperCAmelCase							)
     for j in range(len(_UpperCAmelCase							)							):
          if y[::-1][j] == "1":
               circuit.x(len(_UpperCAmelCase							) + j							)

     return circuit, x, y

def     UpperCAmelCase_						(						_UpperCAmelCase       :qiskit.QuantumCircuit     ,	_UpperCAmelCase       :int     ,	_UpperCAmelCase       :int     ,	_UpperCAmelCase       :int     ,	_UpperCAmelCase       :int     ,	)  ->							int:
     '''simple docstring'''


     circuit.ccx(_UpperCAmelCase     ,	_UpperCAmelCase     ,	_UpperCAmelCase							)
     circuit.cx(_UpperCAmelCase     ,	_UpperCAmelCase							)
     circuit.ccx(_UpperCAmelCase     ,	_UpperCAmelCase     ,	_UpperCAmelCase							)
     circuit.cx(_UpperCAmelCase     ,	_UpperCAmelCase							)
     circuit.cx(_UpperCAmelCase     ,	_UpperCAmelCase							)

def     UpperCAmelCase_						(						_UpperCAmelCase       :int     ,	_UpperCAmelCase       :int     ,	_UpperCAmelCase       :Backend = qiskit.Aer.get_backend('''aer_simulator'''							)     ,	)  ->							int:
     '''simple docstring'''


     if vala < 0 or vala < 0:
          raise ValueError('''Both Integers must be positive!'''							)

     # Store the Integers
     A_      ,						A_      ,						A_					      =  store_two_classics(_UpperCAmelCase     ,	_UpperCAmelCase							)
     for i in range(len(_UpperCAmelCase							)							):
          full_adder(_UpperCAmelCase     ,	_UpperCAmelCase     ,	len(_UpperCAmelCase							) + i     ,	len(_UpperCAmelCase							) + len(_UpperCAmelCase							) + i     ,	len(_UpperCAmelCase							) + len(_UpperCAmelCase							) + i + 1							)
          circuit.barrier()  # Optional, just for aesthetics

     # Measure the resultant qBits
     for i in range(len(_UpperCAmelCase							) + 1							):
          circuit.measure([(len(_UpperCAmelCase							) * 2) + i]     ,	[i]							)

     A_					      =  qiskit.execute(_UpperCAmelCase     ,	_UpperCAmelCase     ,	shots=1							).result()

     # The result is in binary. Convert it back to int
     return int(list(res.get_counts()							)[0]     ,	2							)


if __name__ == "__main__":
      import doctest

      doctest.testmod()










def     UpperCAmelCase_						(						_UpperCAmelCase       :int = 1000							)  ->							int:
     '''simple docstring'''


     A_					      =					[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_					      =					[0, 0, 6, 6, 5, 5, 5, 7, 6, 6]

     A_					      =					0

     for i in range(1     ,	n + 1							):
          if i < 1000:
               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 // 1000] + 8
     return count


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



