651. 4 Keys Keyboard

Imagine you have a special keyboard with 4 keys:

  1. A: Prints 'A' on screen
  2. Ctrl-A: Select all
  3. Ctrl-C: Copy selection
  4. Ctrl-V: Paste

Given n keystrokes, maximize the number of 'A's displayed on screen.

Examples
Input: 3
Output: 3
Hints
Related Problems

651. 4 Keys Keyboard

Imagine you have a special keyboard with 4 keys: