#define F(k,v)d[j]>d[j+k]+v?d[j]=d[j+k]+v:0 d['@@'];n;main(p,a,b,c,j){scanf("%d%d",&n,&p);for(memset(d+p+1,99,12);j++