Countdown#11845

Countdown

1 second
256 megabytes
Medium

Agent 007 is once again saving the planet: only a few seconds remain until the explosion, and a red seven-segment display on the bomb's casing shows the countdown. Each digit of this countdown consists of seven independent light segments that illuminate to form the familiar shapes "0", "1", …, "9".

After defusing the detonator, the legendary agent, not missing an opportunity to philosophize, wondered to himself: "How many segments in total would light up if the display consecutively showed all numbers from down to ?"

The digits and segments on the display looked like this:

Sadly, the agent is too busy with the next world-saving mission, so you must answer his philosophical question. Determine the total number of illuminated segments required to display all integers from down to inclusive.

Input

The input file contains a single integer (1 \le n \le 10^{9}).

Output

Output a single integer — the total number of illuminated segments required to display all numbers from down to inclusive.

Examples

Example

Input
3
Output
18

Example 1

Loading
Loading

Example 2

Loading
Loading

Note

In the first example, for n=3 the numbers 3,2,1,0 are displayed in sequence, and the total number of lit segments for these digits is 5 + 5 + 2 + 6 = 18.