X = int(input()) # Each entry corresponds to j=0 to 6 (moves 1 to 7), storing the cumulative distance up to that move in a set add_distance = [2, 4, 5, 6, 8, 9, 10] candidates = [] for j in range(7): valid = False possible_k = 0 if j in [0, 3, 6]: # Equation: X = 2k → k = X/2 if X % 2 == 0: possible_k = X // 2 valid = 1 <= possible_k <= 100 elif j in [1, 4]: # Equation: X = 2k + 2 → k = (X-2)/2 if (X - 2) >= 0 and (X - 2) % 2 == 0: possible_k = (X - 2) // 2 valid = 1 <= possible_k <= 100 elif j in [2, 5]: # Equation: X = 2k + 1 → k = (X-1)/2 if X % 2 == 1: possible_k = (X - 1) // 2 valid = 1 <= possible_k <= 100 if valid: candidates.append((possible_k, j)) # Find the candidate with the smallest k, and then smallest j if candidates: # Sort by k then j candidates.sort() best_k, best_j = candidates[0] total_distance = 10 * (best_k - 1) + add_distance[best_j] print(total_distance) else: # According to the problem constraints, this path should never be taken print(0)