import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string; void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}} void readC(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=readln.splitter;foreach(ref v;t){v[i]=r.front.to!(ElementType!(typeof(v)));r.popFront;}}} void main() { int n, m, k; readV(n, m, k); int[] a; readC(n+1, a); auto dp = new long[][](n+1, m+1); dp[0][0] = k; foreach (i; 0..n) foreach (j; 0..m+1) { dp[i+1][j] = max(dp[i+1][j], dp[i][j]); if (j < m) foreach (i2; i+1..n+1) dp[i2][j+1] = max(dp[i2][j+1], dp[i][j]/a[i]*a[i2]+dp[i][j]%a[i]); } writeln(dp[$-1].maxElement); }