PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000190. Mua thực phẩm và hoàn tiền (Food Buying)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Mua thực phẩm và hoàn tiền (Food Buying)

Food Buying

Source: Codeforces

Version: Phuoc Hung OJ (single-case adaptation where applicable)

Problem Statement

Mishka initially has ss units of money. On each purchase he may spend any integer xx between 11 and his current balance; he then receives ⌊x/10⌋\lfloor x/10\rfloor units of cashback. He may repeat purchases arbitrarily. Find the maximum total amount spent on purchases, including spending previously received cashback.

Input

The only line contains ss.

Output

Print the maximum total amount spent.

Subtasks

  • Subtask 1 (20 points): 1≤s≤1001\le s\le 100.
  • Subtask 2 (30 points): 1≤s≤1000001\le s\le 100000.
  • Subtask 3 (50 points): 1≤s≤10000000001\le s\le 1000000000.

Examples

Example 1

Input

19

Output

21

Explanation

Spend 10 and receive 1 cashback, leaving 10; spend 10 and receive 1 again, then spend the final 1. The total spent is 21.

Example 2

Input

10

Output

11

Explanation

Spending 10 earns 1 cashback, which can also be spent. Thus the maximum total is 11.