A prince ofthe Science Continent was imprisoned in a castle because of his
contempt for mathematics when he was young, and was entangled insome mathematical
curses. He studied hard until he reached adulthood and decided to use his knowledge
to escape the castle.
There are NNN rooms fromthe place where he was imprisoned totheexitofthe
castle. In the ithi^{th}ith room, there is a wizard who has a resentment value of
a[i]a[i]a[i]. The prince has MMM curses, the jthj^{th}jth curse is f[j]f[j]f[j],
and f[j]f[j]f[j] represents one ofthe four arithmetic operations, namely
addition('+'), subtraction('-'), multiplication('*'), andinteger division('/').
The prince's initial resentment value is KKK. Entering a room and fighting withthe
wizard will eliminate a curse, butthe prince's resentment value will become theresultofthe arithmetic operation f[j]f[j]f[j] withthe wizard's resentment value.
That is, ifthe prince eliminates the jthj^{th}jth curse inthe ithi^{th}ith room,
then his resentment value will change from xxx to (x f[j] a[i]x\ f[j]\ a[i]x f[j]
a[i]), for example, when x=1,a[i]=2,f[j]=x=1, a[i]=2, f[j]=x=1,a[i]=2,f[j]='+',
then xxx will become 1+2=31+2=31+2=3.
Before the prince escapes fromthe castle, he must eliminate all the curses. He
must go from a[1]a[1]a[1] to a[N]a[N]a[N] in order and cannot turn back. He must
also eliminate the f[1]f[1]f[1] to f[M]f[M]f[M] curses in order(It is guaranteed
that N≥MN\ge MN≥M). What isthe maximum resentment value thatthe prince may have
when he leaves the castle?
【Input】
The first line contains an integer T(1≤T≤1000)T(1 \le T \le 1000)T(1≤T≤1000), which
is the number of test cases.
For each test case, the first line contains three non-zero integers:
N(1≤N≤1000),M(1≤M≤5)N(1 \le N \le 1000), M(1 \le M \le 5)N(1≤N≤1000),M(1≤M≤5) and
K(−1000≤K≤1000K(-1000 \le K \le 1000K(−1000≤K≤1000), the second line contains NNN
non-zero integers: a[1],a[2],...,a[N](−1000≤a[i]≤1000)a[1], a[2], ..., a[N](-1000
\le a[i] \le 1000)a[1],a[2],...,a[N](−1000≤a[i]≤1000), and the third line contains
MMM characters: f[1],f[2],...,f[M](f[j]=f[1], f[2], ..., f[M](f[j]
=f[1],f[2],...,f[M](f[j]='+','-','*','/', with no spaces in between.
【Output】
For each test case, output oneline containing a single integer.