AT_past202212_h 桁差の和

Description

You are given a positive integer $ N $ that has $ D $ digits when written in base $ 10 $ . For $ 1\leq k\leq D $ , let $ A_k $ be the $ k $ -th digit from the top when $ N $ is written in base $ 10 $ . Find the value $ \displaystyle\sum_{i=1}^{D-1}\sum_{j=i+1}^D \lvert A_i-A_j \rvert $ .

Input Format

The input is given from Standard Input in the following format: > $ D $ $ N $

Output Format

Print the answer.

Explanation/Hint

### Sample Explanation 1 We have $ D=3 $ , $ A_1=2 $ , $ A_2=8 $ , and $ A_3=7 $ , so the sought value is $ \lvert 2-8 \rvert+\lvert 2-7 \rvert+\lvert 8-7 \rvert=12 $ . ### Constraints - $ 2 \leq D \leq 2\times 10^5 $ - $ D $ is an integer. - $ N $ is a $ D $ -digit positive integer. - The topmost digit of $ N $ is not $ 0 $ .