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
// practice with kaiboy
import java.io.*;
import java.util.*;

public class Main extends PrintWriter {
	Main() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		Main o = new Main(); o.main(); o.flush();
	}

	static final int A = 26;
	void main() {
		byte[] aa = sc.next().getBytes();
		byte[] bb = sc.next().getBytes();
		int n = aa.length;
		int m = bb.length;
		int inf = n * 2;
		int[][] dd = new int[n + 1][A];
		Arrays.fill(dd[n], inf);
		for (int i = n - 1; i >= 0; i--) {
			int a = aa[i] - 'a';
			dd[n][a] = i;
		}
		for (int i = n - 1; i >= 0; i--) {
			for (int a = 0; a < A; a++)
				dd[i][a] = 1 + dd[i + 1][a];
			int a = aa[i] - 'a';
			dd[i][a] = 0;
		}
		long i = 0;
		for (int j = 0; j < m; j++) {
			int a = bb[j] - 'a';
			int d = dd[(int) (i % n)][a];
			if (d >= inf) {
				println(-1);
				return;
			}
			i += d + 1;
		}
		println(i);
	}
}
