#include<stdio.h>
int main(){

  int a,b;
  int x,y,z;
  scanf("%d %d",&a,&b);

  while(1){
    b=b-a;

    z=b/1000;
    b=b%1000;

    y=b/500;
    b=b%500;

    x=b/100;

    printf("%d %d %d\n",x,y,z);
    scanf("%d %d",&a,&b);

    if(a==0 && b==0) break;
  }

  return 0;
}