#include int main(){ // 野菜の数・肉の数・比率・許容量 int vegetables, meat, proportion, all; scanf("%d%d%d%d",&vegetables,&meat,&proportion,&all); if(meat == all){ printf("0"); }else if(vegetables + meat < all){ printf("%d",meat / proportion); }else{ int tmp = all / (proportion + 1); if(tmp < vegetables){ printf("%d",tmp); }else{ printf("%d",vegetables); } } }