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
						//		package Dynamic;
import java.io.*;
import java.util.*;
public class Main{
	static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;
    static public void main(String[] args)throws IOException{
    	st=new StringTokenizer(br.readLine());
    	String s=s();
    	String t=s();
    	TreeSet<Integer> ar[]=new TreeSet[26];
    	for(int x=0;x<26;x++)
    		ar[x]=new TreeSet<>();
    	for(int x=0;x<s.length();x++)
    	{
    		ar[s.charAt(x)-97].add(x+1);
    	}
    	for(int x=0;x<t.length();x++)
    	{
    		if(ar[t.charAt(x)-97].size()==0)
    		{
    			pl("-1");
    			System.exit(0);
    		}
    	}
    	long c=0l;
    	long tt=-1l;
    	int len=t.length();
    	//pl(Arrays.toString(ar));
    	o:
    	for(int x=0;x<len;x++)
    	{
    		tt++;
    		int val=ar[t.charAt(x)-97].first();
    		//pl(val+"");
    		c=(tt*s.length())+val;
    		//int d=0;
    		while(x!=len-1)
    		{
    			Integer vv=ar[t.charAt(x+1)-97].higher(val);
    			if(vv==null)	continue o;
    			else	c=(tt*s.length())+vv;
    			x++;
    			val=vv;
    			//d=1;
    		}
    		//if(d==1&&x==len-1)	x--;
    		
    	}
    	pl(c+"");
    	
    }
    
    static int i()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Integer.parseInt(st.nextToken());
    }
    static long l()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Long.parseLong(st.nextToken());
    }
    static String s()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return st.nextToken();
    }
    static double d()throws IOException
    {
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	return Double.parseDouble(st.nextToken());
    }
    static void p(String p)
    {
    	System.out.print(p);
    }
    static void pl(String pl)
    {
    	System.out.println(pl);
    }
    static void pl()
    {
    	System.out.println();
    }
    static int[] ari(int n)throws IOException
    {
    	int ar[]=new int[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=i();
    	return ar;
    }
    static long[] arl(int n)throws IOException
    {
    	long ar[]=new long[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=l();
    	return ar;
    }
    static String[] ars(int n)throws IOException
    {
    	String ar[]=new String[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=s();
    	return ar;
    }
    static double[] ard(int n)throws IOException
    {
    	double ar[]=new double[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=d();
    	return ar;
    }
    static char[] arc(int n)throws IOException
    {
    	char ar[]=new char[n];
    	if(!st.hasMoreTokens())
    		st=new StringTokenizer(br.readLine());
    	for(int x=0;x<n;x++)
    		ar[x]=st.nextToken().charAt(0);
    	return ar;
    }
    static void pari(int ar[])
    {
    	for(int a:ar)
    		System.out.print(a+" ");
    }
    static void parl(long ar[])
    {
    	for(long a:ar)
    		System.out.print(a+" ");
    }
    static void pars(String ar[])
    {
    	for(String a:ar)
    		System.out.print(a+" ");
    }
    static void pard(double ar[])
    {
    	for(double a:ar)
    		System.out.print(a+" ");
    }
    static void parc(char ar[])
    {
    	for(char a:ar)
    		System.out.print(a+" ");
    }
}