传统题 1000ms 256MiB

Hrahc Likes 114514

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Description

Hrahc is a 24-year-old student. He likes a number 114514\texttt{114514} very much.

Now Hrahc gets a string with numbers. He wants to know how many times the number 114514\texttt{114514} appears as a subsequence (not substring, notice that subsequence is not required to be contiguous) in the string.

Format

Input

The first line contains a single integer n(1n106)n\,(1\leq n\leq 10^6), the length of the string.

The second line contains a string of length nn, consisting of digits from 0\texttt{0} to 9\texttt{9}.

Output

Only one integer: the number of times the number 114514\texttt{114514} appears as a subsequence in the string.

Modulo 114514.

Samples

6
114514
1
7
1114514
3

Hello ACM 2025

未参加
状态
已结束
规则
ACM/ICPC
题目
11
开始于
2025-8-14 13:00
结束于
2025-8-14 18:00
持续时间
5 小时
主持人
参赛人数
46