#P1819. 公共子序列

公共子序列

Description

Find how many distinct common subsequences the 33 character sequences share, excluding the empty sequence.

Input Format

The first line contains a positive integer nn, denoting the length of the 33 sequences. The next 33 lines each contain a length-nn character sequence without spaces. Only lowercase letters a to z are used.

Output Format

One line with a positive integer ansans, taken modulo 10810^8.

4   
aabb   
abab   
baba

5

Hint

Sample 1 Explanation

For the single sample, there are 55 subsequences: a, ab, aa, bb, b.

Constraints and Conventions

  • For 30%30\% of the testdata, it is guaranteed that 1n101 \le n \le 10.
  • For 70%70\% of the testdata, it is guaranteed that 1n501 \le n \le 50.
  • For 100%100\% of the testdata, it is guaranteed that 1n1501 \le n \le 150.

Translated by ChatGPT 5