#include<stdio.h>

int main(void)
{
  int price;
  int have;
  int a;
  int b;
  int c;
  int m;
  int n;
  int x;
  while(1)
    {
      scanf("%d %d", &price, &have);
      
      x = have - price;
      
      a = x / 1000;
      m = x % 1000;
      b = m / 500;
      n = m % 500;
      c = n / 100;
      

      
      if(price == 0 && have == 0)
	{
	  break;
	}
      printf("%d %d %d\n",c,b,a);

    }
      
      return 0;
}