#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m, k; cin >> n >> m >> k; vector> tb(m); vector a(m); for(int i = 0, v; i < n; i++){ cin >> v; tb[--v].emplace_back(i); } cin >> a; ll ans = 1ll << 61; for(int i = 0; i < m; i++){ for(int l = 0, r = 0; l < tb[i].size(); l++){ while(r < tb[i].size() && tb[i][r] < tb[i][l] + m) r++; ans = min(ans, a[i] * (m - r + l)); } } cout << ans << '\n'; }