{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"MD","content":"Dogecoin prices are exploding right now. Seeing the potential profits, you decide to enter the market too. You know this is a risky and possibly addictive business so you decide to trade only for one day.\n\nIn the morning, there are **n** opportunities to buy Dogecoins. You can buy as many coins as you want for a price of Ai\n\nIn the evening, there are **m** opportunities to sell Dogecoins. You can sell as many as you want for a price of Bi. You can\u0027t sell more than you have.\n\nThe day has just begun and you have **r** rupees and no Dogecoins\n\nWhat is the maximum amount of money you can posses in the evening?"}},{"title":"Input","value":{"format":"MD","content":"The first line of the input contains three integers **n**, **m**, **r** (1≤ **n** ≤30, 1≤ **m** ≤30, 1≤ **r** ≤1000) — the number of opportunities to buy Dogecoin on the market, the number of opportunities to sell Dogecoin on the market, and the amount of rupees you have at the start of the day.\n\nThe next line contains **n** integers A1,A2,…,An (1≤ Ai ≤1000) - indicates the price of Dogecoin at the i-th opportunity to buy in the morning\n\nThe following line contains **m** integers B1,B2,…,Bm (1≤ Bi ≤1000) - indicates the price of Dogecoin at the i-th opportunity to sell in the evening"}},{"title":"Output","value":{"format":"MD","content":"Output a single integer — the maximum number of rupees you can have after one day of trading."}},{"title":"Examples","value":{"format":"MD","content":"**Input 1**\n3 4 11\n4 2 5\n4 4 5 4\n\n**Output 1**\n26\n \n**Input 2**\n2 2 50\n5 7\n4 2\n\n**Output 2**\n50"}},{"title":"Note","value":{"format":"MD","content":"In the first case, you have 11 rupees in the morning. It\u0027s optimal to buy 5 Dogecoins at the price of 2 rupees, and then to sell all of them at the price of 5 rupees in the evening.\n\nIn the second case, the best choice is to not trade at all"}}]}