#include using namespace std; typedef pair P; typedef pair> PP; typedef long long ll; const double EPS = 1e-8; const int INF = 1e9; const int MOD = 1e9+7; int dy[] = {0,1,0,-1}; int dx[] = {1,0,-1,0}; struct edge{int to,cost,tm;}; int main(void) { int n,c,v; cin >> n >> c >> v; vector s(v),t(v),y(v),m(v); for(int i=0;i> s[i]; for(int i=0;i> t[i]; for(int i=0;i> y[i]; for(int i=0;i> m[i]; for(int i=0;i> es(n+1); for(int i=0;i> dp(n+1,vector(c+1,INF)); dp[0][c] = 0; for(int i=0;i