Given are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists.

* Let s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\ldots{s'}_i (the first i characters in s').

Constraints

* 1 \leq |s| \leq 10^5
* 1 \leq |t| \leq 10^5
* s and t consists of lowercase English letters.

Input

Input is given from Standard Input in the following format:


s
t


Output

If there exists an integer i satisfying the following condition, print the minimum such i; otherwise, print `-1`.

Examples

Input

contest
son


Output

10


Input

contest
programming


Output

-1


Input

contest
sentence


Output

33
#include<cstdio>
#include<cstring>
typedef long long ll;
const int N=100010;

int ls,lt,cnt[26],v[26][N]; ll ans; char s[N],t[N];
int main() {
	scanf("%s%s",s+1,t+1); ls=strlen(s+1); lt=strlen(t+1);
	for (int i=1; i<=ls; ++i) { int x=s[i]-'a'; v[x][++cnt[x]]=i; } 
	for (int i=1; i<=lt; ++i)
		if (!cnt[t[i]-'a']) return puts("-1"),0;
	int j=0,k;
	for (int i=1; i<=lt; ++i) {
		int x=t[i]-'a';
		if (j>=v[x][cnt[x]]) { 
			ans+=ls-j+v[x][1];
			j=v[x][1]; continue;
		}
		int l=1,r=cnt[x];
		while (l<r) { int m=l+r>>1; v[x][m]>j?(r=m):(l=m+1); }
		ans+=1ll*v[x][r]-j; j=v[x][r];
	}
	printf("%lld\n",ans);
	return 0;
}