#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	int value,money;
	while(cin>>value>>money&&!(value==0&&money==0)){
		int left=money-value;
		int sen=0;
		int gohyaku=0;
		int hyaku=0;

		sen=left/1000;
		left-=sen*1000;
		gohyaku=left/500;
		left-=gohyaku*500;
		hyaku=left/100;
		cout<<hyaku<<" "<<gohyaku<<" "<<sen<<endl;
	}
	return 0;
}