Universal Cup Judging System

Universal Cup

Süre Sınırı: 1.0 s Bellek Sınırı: 1024 MB Toplam puan: 100
İstatistikler

John takes security very seriously, so his password is very long: it has $n$ characters. However, he is not very creative, so all characters in the password are the same — the letter a. John is very impatient, so he would like to type the password as fast as possible.

He wants to obtain a string consisting of exactly $n$ letters a. He can use a sequence of the following actions: "a" (type the letter a), "Ctrl-A" (select everything), "Ctrl-C" (copy to the clipboard), "Ctrl-V" (paste from the clipboard). What is the minimal number of actions needed to achieve the desired result when starting from an empty password box and an empty clipboard?

Below are precise definitions of all four actions John can take in the password box:

  • Pressing "a": If no text is selected, insert the letter a at the position of the cursor (to the left). Otherwise, replace the selected text with the letter a. After that, no text is selected and the cursor is positioned at the end of the password box.
  • Pressing "Ctrl-A": Select all text in the password box.
  • Pressing "Ctrl-C": If no text is selected, do nothing. Otherwise, copy the selected text to the clipboard.
  • Pressing "Ctrl-V": If the clipboard is empty, do nothing. Otherwise, if no text is selected, insert the text from the clipboard at the position of the cursor (to the left). Otherwise, replace the selected text with the text from the clipboard. In the end, no text is selected and the cursor is positioned at the end of the password box. The contents of the clipboard do not change.

Input

The first and only line of the input contains one integer $n$ ($1 \le n \le 10^{12}$), denoting the desired length of the password.

Output

Output one integer, the minimal number of actions needed to type the password with the desired length.

Example

Input

11

Output

10

Note

John can use the following sequence of actions: a, a, Ctrl-A, Ctrl-C, Ctrl-V, Ctrl-V, Ctrl-V, Ctrl-V, Ctrl-V, a.

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1051EditorialOpen题解jianglyView

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.