A digital string is defined as a string of length N consisting of the digits 2, 4, 6, or 8.
You are given an empty string and the digits have to be entered in this string such that no two adjacent digits are the same.
For each position in the string, you are given four integers P,Q,R,S. These integers denote the cost of entering 2, 4, 6, or 8 respectively in that position in the string.
Write a program to determine the minimum cost of a digital string.
Note: P, Q, R, and S denote the cost of entering the digit 2, 4, 6, or 8 in the string respectively
Input format
Output format
Print the minimum cost of a digital string.
Constraints
1≤T≤10
1≤N≤105
P,Q,R,S≤1000
Best choice is to fill 1st space with digit "2" with cost 2 and 2nd space with digit "8" with cost 1.so total cost will be 3 and final digital string will be "28".