Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

J. Two Prefixes

time limit per test

1 secondmemory limit per test

512 megabytesinput

standard inputoutput

standard outputMisha didn't do his math homework for today's lesson once again. As a punishment, his teacher Dr. Andrew decided to give him a hard, but very useless task.

Dr. Andrew has written two strings *s* and *t* of lowercase English letters at the blackboard. He reminded Misha that prefix of a string is a string formed by removing several (possibly none) of its last characters, and a concatenation of two strings is a string formed by appending the second string to the right of the first string.

The teacher asked Misha to write down on the blackboard all strings that are the concatenations of some non-empty prefix of *s* and some non-empty prefix of *t*. When Misha did it, Dr. Andrew asked him how many distinct strings are there. Misha spent almost the entire lesson doing that and completed the task.

Now he asks you to write a program that would do this task automatically.

Input

The first line contains the string *s* consisting of lowercase English letters. The second line contains the string *t* consisting of lowercase English letters.

The lengths of both string do not exceed 10^{5}.

Output

Output a single integer — the number of distinct strings that are concatenations of some non-empty prefix of *s* with some non-empty prefix of *t*.

Examples

Input

aba

aa

Output

5

Input

aaaaa

aaaa

Output

8

Note

In the first example, the string *s* has three non-empty prefixes: {a, ab, aba}. The string *t* has two non-empty prefixes: {a, aa}. In total, Misha has written five distinct strings: {aa, aaa, aba, abaa, abaaa}. The string abaa has been written twice.

In the second example, Misha has written eight distinct strings: {aa, aaa, aaaa, aaaaa, aaaaaa, aaaaaaa, aaaaaaaa, aaaaaaaaa}.

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jun/26/2019 08:01:42 (e3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|