#include<stdio.h>
int main(void){
  int book,pay,rest;
  int a,b,c;
  
  while(1){
  scanf("%d %d",&book,&pay);
  if(book==0 && pay==0)
    break;
  rest=pay-book;
  
  a=rest/1000;
  rest=rest-1000*a;

  b=rest/500;
  rest=rest-500*b;

  c=rest/100;
  
  printf("%d %d %d\n",c,b,a);
  }
  return 0;
}
  
  