logo AlgoBeat OnlineJudge
登录 注册

#217783. [JAG 2026 Summer Camp #1] CPK! Remix

内存限制:2048 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Kaguya spends her days enjoying parfaits and taking part in programming contests.

She has a string of length consisting of uppercase English letters. She may perform the following operation any number of times, including zero.

  • Choose an integer () such that is one of CPK, CKP, and PCK. Replace with any one of CPK, CKP, and PCK.

Find the number of distinct strings that can be obtained from by performing the operation any number of times, modulo .

输入格式

The input consists of a single test case of the following format.

N
S

The first line contains an integer (), representing the length of the string .

The second line contains a string of length consisting of uppercase English letters.

输出格式

Print the number of distinct strings that can be obtained from , modulo .

样例

样例输入 1

9
CPKCKPPCK

样例输出 1

63

样例输入 2

34
CPKPARTICIPATEDINPCKWHILEEATINGCKP

样例输出 2

45

样例输入 3

15
CPKCPKCPKCPFKKK

样例输出 3

63