Public Judge

pjudge

時間限制: 1 s 記憶體限制: 256 MB 總分: 100

#21857. 【NOIP Round #7】Fill in the Numbers

统计

Given two sequences $A$ and $B$ of positive integers, both of length $n$, let $f(x)$ denote the number of digits of $x$ in decimal representation.

Little K needs to choose one number $A_i$ from $A$ and one number $B_j$ from $B$. You need to calculate the sum of $f(A_i+B_j)$ for all $n^2$ possible pairs.

Formally, you need to calculate $\sum_{i=1}^{n} \sum_{j=1}^{n} f(A_i+B_j)$.

Input

The first line contains a positive integer $N$.

The second line contains $N$ positive integers representing the sequence $A$.

The third line contains $N$ positive integers representing the sequence $B$.

Output

Output a single integer representing the answer.

Examples

Input 1

3
97 79 7
20 2 21

Output 1

20

Input 2

See the provided files.

Constraints

For all data, we have:

  • $1 \le n \le 1.5 \times 10^5$
  • $1 \le A_i,B_j \lt 10^9$
Subtask Special Properties Score
$1$ $n=1$ $10$
$2$ $n \le 2000$ $20$
$3$ $A_i,B_j \le 2000$ $10$
$4$ $10^8 \le A_i,B_j \le 5 \times 10^8$ $10$
$5$ $A_i,B_j \ge 10^8$ $10$
$6$ $A_i \le 1.5 \times 10^5,\space B_j=j$ $10$
$7$ $B_j = j$ $10$
$8$ No special restrictions $20$

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.