in:
3 3 a a a
out:
1951
hack题解:https://www.luogu.com.cn/article/9yjxxd7k https://www.luogu.com.cn/article/qkbr9de2