using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var a = ReadLine(); var s = ReadLine(); var t = s.ToCharArray(); for (var i = 0; i < t.Length; ++i) if (t[i] >= '0' && t[i] <= '9') t[i] = a[t[i] - '0']; WriteLine(string.Concat(t)); } }