\problemname{Killing Chaos}
\illustration{.4}{guns_rail}{\href{https://commons.wikimedia.org/wiki/File:Ned_Kelly_attemps_to_derail_train.jpg}{Public Domain, via Wikimedia Commons}}

\noindent
In the dangerous wild west, robbers are attacking a long train with many coaches. Chaos erupts, and the robbers realize that the amount of chaos equals the number of passengers in the train, rounded up to the nearest multiple of $10$. In order to quench the chaos, they therefore decide to kill some passengers by blowing up one of the coaches.

What the robbers failed to realize, however, is that when there are multiple disjoint train segments, then the total amount of chaos is equal to the sum of the chaos of each train segment {\em times} the number of train segments!

Frantic to quench the now even worse chaos, the robbers continue blowing up every coach until all passengers are dead. Phew!

The chaos in a train segment is equal to the number passengers in that train segment rounded up to the nearest multiple of $10$. What was the maximum amount of chaos during the robbery?

\section*{Input}
On the first line is a single integer $n$, ($3 \leq n \leq 100\,000$), the number of coaches in the train. On the second line follows $n$ integers $p_1, p_2, \ldots\, p_n$, ($0 \leq p_i \leq 100$ for each $i \in \{1, 2, \ldots, n\}$) the number of passengers in each coach.
On the third and final line follows a permutation of the numbers from $1$ to $n$ indicating the order in which the robbers blew up the coaches.

\section*{Output}
A single integer, the maximum chaos that occurred during the robbery.
