#include <stdio.h>
int main(void) {
  int cd, cash, fif=0, one=0;
  while(scanf("%d%d",&cd,&cash),cd+cash) {
    cash -= cd;
    one = cash / 1000;
    cash %= 1000;
    fif = cash / 500;
    cash %= 500;
    printf("%d %d %d\n",cash/100,fif,one);
  }
  return(0);
}