#CCBCHBAHAI0000152. Vanya và hàng rào (Vanya and Fence)
Vanya và hàng rào (Vanya and Fence)
Vanya and Fence
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Vanya walks with friends along a fence of height . Friend has height .
- If , that friend walks normally and needs width .
- If , that friend bends down and needs width .
They walk in one row. Compute the minimum road width required for the whole group.
Equivalently,
$$W=\sum_{i=0}^{n-1}\begin{cases} 1,&a_i\le h,\\ 2,&a_i>h. \end{cases}$$Input
- The first line contains integers and .
- The second line contains integers .
Output
Print the integer .
Subtasks
Subtask 1 (100 points): ; ; .
Examples
Input
3 7
4 5 14
Output
4
Explanation
Heights and do not exceed , so each contributes width . Height contributes width . Thus .