#include<stdio.h>

int main(void){
  int i;
  int pri,am;
  int bi1,bi5,bi10;

  for(;;){
    scanf("%d%d",&pri,&am);
    if(pri==0 && am==0)
      break;

    am-=pri;

    bi10=am/1000;
    am%=1000;
    bi5=am/500;
    am%=500;
    bi1=am/100;

    printf("%d %d %d\n",bi1,bi5,bi10);
  }

  return 0;
}