Problem Statement
You are given a string $S$ of length $N$, a string $T$ of length $M$, and a positive integer $K$. Each character of $S$ and $T$ is a lowercase English letter.
Let $X$ be the string obtained by repeating $S$ for $K$ times. Print Yes if $T$ is contained in $X$ as a substring, and No otherwise. Here, a substring of $X$ refers to a string obtained by deleting $0$ or more characters from the beginning of $X$ and $0$ or more characters from the end of $X$.
Constraints
- $1 \le N \le 100$.
- $S$ is a string of length $N$ consisting only of lowercase English letters.
- $1 \le M \le 100$.
- $T$ is a string of length $M$ consisting only of lowercase English letters.
- $1 \le K \le 10^9$.
- $N, M, K$ are integers.
Subtasks
- ($25$ points) $K = 1$.
- ($25$ points) $K \le 100$.
- ($25$ points) Each character of $S, T$ is
a. - ($25$ points) No additional constraints.
Input
The input is given in the following format:
N S M T K
Output
Print Yes if $T$ is contained in $X$ as a substring, and No otherwise.
Do not print anything other than the answer. (For example, do not print any text prompting for input.)
For the answer format, you may refer to the practice problems and their sample solutions.
Sample 1
Input
4 joig 3 joi 1
Output
Yes
$X$ is joig, which contains joi as a substring. Therefore, print Yes.
This sample input satisfies the constraints of Subtasks $1, 2, 4$.
Sample 2
Input
3 joi 4 joig 2
Output
No
$X$ is joijoi, which does not contain joig as a substring. Therefore, print No.
This sample input satisfies the constraints of Subtasks $2, 4$.
Sample 3
Input
4 aaaa 1 a 1000000000
Output
Yes
$X$ is a string consisting of $4 \times 10^9$ occurrences of a, which contains a as a substring. Therefore, print Yes.
This sample input satisfies the constraints of Subtasks $3, 4$.