{"raw_statement":[{"iden":"problem statement","content":"We have a bipartite graph with $L$ vertices to the left and $R$ vertices to the right.  \nTakahashi will install surveillance cameras in these vertices.  \nInstalling cameras incurs the following cost.\n\n*   $A_i$ yen (the Japanese currency) for each camera installed in the $i$\\-th $(1 \\le i \\le L)$ vertex to the left;\n*   $B_j$ yen (the Japanese currency) for each camera installed in the $j$\\-th $(1 \\le j \\le R)$ vertex to the right.\n\nIt is allowed to install multiple cameras on the same vertex.\nFind the minimum amount of money needed to install cameras to satisfy the following condition.\n\n*   For every pair of integers $(i, j)$ such that $1 \\le i \\le L, 1 \\le j \\le R$, there is a total of $C_{i,j}$ or more cameras installed in the $i$\\-th vertex to the left and $j$\\-th vertex to the right."},{"iden":"constraints","content":"*   All values in input are integers.\n*   $1 \\le L,R \\le 100$\n*   $1 \\le A_i,B_i \\le 10$\n*   $0 \\le C_{i,j} \\le 100$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$L$ $R$\n$A_1$ $A_2$ $\\dots$ $A_L$\n$B_1$ $B_2$ $\\dots$ $B_R$\n$C_{1,1}$ $C_{1,2}$ $\\dots$ $C_{1,R}$\n$C_{2,1}$ $C_{2,2}$ $\\dots$ $C_{2,R}$\n$\\vdots$\n$C_{L,1}$ $C_{L,2}$ $\\dots$ $C_{L,R}$"},{"iden":"sample input 1","content":"3 4\n4 3 6\n5 2 3 4\n1 2 3 2\n2 1 2 3\n3 2 1 2"},{"iden":"sample output 1","content":"37\n\nYou can achieve the objective for $37$ yen as follows, which is the minimum amount required.\n\n*   Install $2$ cameras on the $1$\\-st vertex in the left.\n*   Install $3$ cameras on the $2$\\-nd vertex in the left.\n*   Install $2$ cameras on the $3$\\-rd vertex in the left.\n*   Install $1$ camera on the $1$\\-st vertex in the right.\n*   Install $1$ camera on the $3$\\-rd vertex in the right."},{"iden":"sample input 2","content":"1 1\n10\n10\n0"},{"iden":"sample output 2","content":"0\n\nNo camera may be needed."},{"iden":"sample input 3","content":"5 6\n3 2 6 7 5\n4 9 8 6 2 3\n2 0 2 1 1 0\n2 3 2 1 0 0\n2 2 4 0 2 2\n4 1 0 3 0 2\n1 0 0 2 2 5"},{"iden":"sample output 3","content":"79"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}