题目描述
Problem Background
The confused ScaredQiu often reminisces about the year 2014. If you ask him about the current year, he might also tell you it's 2014.
Problem Description
A "2014 string" is defined as a string formed by concatenating multiple instances of 2014 end-to-end, such as 20142014 and 201420142014. Strings like 2014201 and 572364 are not "2014 strings".
Given a string \( S \) consisting only of digits from \( 0 \) to \( 9 \), you can perform an operation to swap any two characters in \( S \). Determine if it is possible to transform \( S \) into a "2014 string" by performing any number of such operations (including zero).
Input Format
The first line contains an integer \( n \) representing the length of string \( S \).
The second line contains a string \( S \) of length \( n \), guaranteed to consist only of digits from \( 0 \) to \( 9 \).
Output Format
If \( S \) can be transformed into a "2014 string", output Yes; otherwise, output No.
Sample Input and Output
Sample Input #1
8
52510961
Sample Output #1
No
Sample Input #2
10
0573963380
Sample Output #2
No
Sample Input #3
12
140021214240
Sample Output #3
Yes
Notes/Hints
For \( 20\% \) of the data, \( 1 \leq n \leq 8 \).
For \( 40\% \) of the data, \( 1 \leq n \leq 18 \).
For another \( 20\% \) of the data, \( S \) is guaranteed to consist only of the digits \( 0, 1, 2, 4 \).
For \( 100\% \) of the data, \( 1 \leq n \leq 10^6 \), and string \( S \) consists only of digits from \( 0 \) to \( 9 \).
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分