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
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] arr = in.next().toCharArray();
        char[] brr = in.next().toCharArray();

        TreeSet<Integer>[] idx = new TreeSet[26];
        for (int i = 0; i < 26; ++i)
            idx[i] = new TreeSet<>();

        for (int i = 0; i < arr.length; ++i) {
            idx[arr[i] - 'a'].add(i + 1);
        }

        int cur = -1;

        long ans = 0;
        for (int i = 0; i < brr.length; ++i) {
            if (idx[brr[i] -'a'].size() == 0) {
                System.out.println(-1);
                return ;
            }
            
            Integer ceilingInteger = idx[brr[i] - 'a'].higher(cur);
            if (ceilingInteger == null) ceilingInteger = idx[brr[i] - 'a'].first();
            if (cur >= ceilingInteger) {
                ceilingInteger = idx[brr[i] - 'a'].first();
                ans += arr.length;
            }

            cur = ceilingInteger;
        }

        ans += cur;
        System.out.println(ans);
    }
}


class Kattio extends PrintWriter {
    public Kattio(InputStream i) {
	super(new BufferedOutputStream(System.out));
	r = new BufferedReader(new InputStreamReader(i));
    }
    public Kattio(InputStream i, OutputStream o) {
	super(new BufferedOutputStream(o));
	r = new BufferedReader(new InputStreamReader(i));
    }

    public boolean hasMoreTokens() {
	return peekToken() != null;
    }

    public int getInt() {
	return Integer.parseInt(nextToken());
    }

    public double getDouble() { 
	return Double.parseDouble(nextToken());
    }

    public long getLong() {
	return Long.parseLong(nextToken());
    }

    public String getWord() {
	return nextToken();
    }



    private BufferedReader r;
    private String line;
    private StringTokenizer st;
    private String token;

    private String peekToken() {
	if (token == null) 
	    try {
		while (st == null || !st.hasMoreTokens()) {
		    line = r.readLine();
		    if (line == null) return null;
		    st = new StringTokenizer(line);
		}
		token = st.nextToken();
	    } catch (IOException e) { }
	return token;
    }

    private String nextToken() {
        String ans = peekToken();
        token = null;
        return ans;
    }

    public int nextInt() {
        return Integer.parseInt(getWord());
    }

}