#include using namespace std; #define int long long signed main(){ int N,M,K; cin >> N >> M >> K; int c[N + 1],a[M + 1]; for(int i = 1;i <= N;i++) cin >> c[i]; for(int i = 1;i <= M;i++) cin >> a[i]; map m; for(int i = 1;i <= K;i++){ m[c[i]]++; } int ans = pow(10,17); for(auto [key,value] : m){ ans = min(ans,a[key] * (K - value)); } for(int i = K + 1;i <= N;i++){ m[c[i - K]]--; bool b = true; if(m[c[i - K]] == 0){ b = false; m.erase(m[c[i - K]]); } m[c[i]]++; ans = min(ans,a[c[i]] * (K - m[c[i]])); if(b) ans = min(ans,a[c[i - K]] * (K - m[c[i]])); } cout << ans << endl; }