Concatenation

Count distinct strings formed by joining a nonempty prefix of the first word with a nonempty suffix of the second word.

Medium6String matchingCombinatoricsNo attempts yetTime limit2sMemory limit256 MB

Problem

Gennady, a well known programmer, likes to make new words. One way to do it is to concatenate two existing words, that is, to write one word right after another. If he has "cat" and "dog", he gets "catdog", which could name a creature with one cat head and one dog head.

Gennady is bored of that method, so he invented another one. He takes a non-empty prefix of the first word and a non-empty suffix of the second word, then concatenates them. If he has "tree" and "heap", he can get words such as "treap", "tap", or "theap".

Gennady picked two words. Count how many different words he can make with the new method.

Input

The first line contains the first word and the second line contains the second word. Each word has length between 1 and 100,000 and consists of lowercase English letters only.

Output

Print one integer, the number of different words Gennady can make.