SP32945 ADASEQEN - Ada and Subsequence

Description

Ada the Ladybug has two string which she wants to give to her friends. As she doesn't want to distinguish between them, she wants to use only some common subsequence. Firstly she wanted to simply use the longest common subsequence but then she realized it wouldn't be _kosher_. She assigned a positive value to each letter. Now she wants to find the most expensive subsequence.

Input Format

The first line of each test-case will contain two integers **1 , the length of each subsequence.** The next line will contain **26** integers (**1 ), the price of each letter.** The next line will contain string of length **N** consisting of lowercase english alphabet. The next line will contain string of length **M** consisting of lowercase english alphabet.

Output Format

For each test-case, print the cost of the most expensive common subsequence.