Guest
Login
跳过导航链接

Careless Tony
Time Limit:1000MS  Memory Limit:32768K

Description:

Tony is such a careless typist that he finds himself making mistakes AGAIN. What's worse, the cursor key is not working so that he can only use the backspace key to reach the place where the mistake is, and then type whatever he's deleted on the way AGAIN :(
Now let's help Tony find out at least how long it will cost him to correct his mistake.

Input:

The first line of input contains an integer N, which is the number of test cases. Then N test cases follow.<BR> Each test case consists of 3 lines of input: the 1st line contains a positive integer t (<= 100), which is the time taken for Tony to delete/input a character; the 2nd line contains the correct content of text; and the 3rd line contains the text typed by Tony.<BR> Note: The text contents contain only the readable characters. The total length of each text is no longer than 80 characters.<BR>

Output:

For each test case, print in one line the minimal time taken for Tony to correct his mistake.

Sample Input:

2
1
WishingBone
WashingBone
1
Oops
Oooops

Sample Output:

20
6
Status  Submit


Zhe Jiang University Of Technology Online Programming Space Beta1.3
Designed & Developped By Jin Qiwei
 All Copyright Reserved 2006
640