Just some trivial

## A - String

### 题目描述

Gromah and LZR entered the great tomb, the first thing they see is a matrix of size $n \times m$ , and the elements in the matrix are all $0$ or $1$ .

LZR finds a note board saying “An all-one matrix is defined as the matrix whose elements are all $1$ , you should determine the number of all-one submatrices of the given matrix that are not completely included by any other all-one submatrices” .

Meanwhile, Gromah also finds a password lock, obviously the password should be the number mentioned in the note board!

### 输入描述

The first line contains two positive integers $n,m$ denoting the size of given matrix.

Following $n$ lines each contains a string with length $m$ ，whose elements are allor $0$ or $1$ ，denoting the given matrix.

$1\le n,m \le 3000$

### 输出描述

Print a non-negative integer, denoting the answer.

### 示例1

#### 说明

The 5 matrices are $(1,2)-(1,4), \; (1,2)-(2,3), \; (1,2)-(3,2), \; (2,1)-(2,3), \; (3,4)-(3,4)_{}$ .

## B - Beauty Values

### 题目描述

Gromah and LZR have entered the second level. There is a sequence $a_1, a_2, \cdots, a_n$ on the wall.

There is also a note board saying “the beauty value of a sequence is the number of different elements in the sequence”.

LZR soon comes up with the password of this level, which is the sum of the beauty values of all successive subintervals of the sequence on the wall.

### 输入描述

The first line contains one positive integer $n$ , denoting the length of the sequence.

The second line contains $n$ positive integers $a_1, a_2, \cdots, a_n$ , denoting the sequence.

$1 \le a_i \le n \le 10^5$

### 输出描述

Print a non-negative integer in a single line, denoting the answer.

### 示例1

#### 说明

The beauty values of subintervals $[1,1], [2,2], [3,3], [4,4]$ are all $1$ .

The beauty values of subintervals $[1,2], [1,3], [2,3], [3,4]$ are all $2$ .

The beauty values of subintervals $[1,4], [2,4]$ are all $3$ .

As a result, the sum of all beauty values are $1\times 4 + 2\times 4 + 3\times 2 = 18$ .