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

using namespace std;






int main()
{
	int N, Y;
	cin >> N >> Y;

	int set[3] = {-1,-1,-1};


	for (int i = 0; i <= N; i++)
	{
		for (int j = 0; i + j <= N; j++)
		{
			int k = N - i - j;
			int z = 10000 * i + 5000 * j + 1000 * k;
			if (z == Y)
			{
				set[0] = i;
				set[1] = j;
				set[2] = k;
				goto loopend;
			}
			else if(z > Y)
			{
				break;
			}
		}
	}

loopend:
	cout << set[0] << ' ' << set[1] << ' ' << set[2];

}


#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long ll;
#define i(x) cin>>x
#define fr(n,x) for(ll n=0;n<x;n++)
#define pf(x) cout<<x
const ll mod=1e9+7 ;


int main()
{
    ios_base::sync_with_stdio(false),cin.tie(NULL);
    ll x,y;
    cin>>x>>y;
    if (y-x>=2019)
    {
        cout<<0;
        return 0;
    }
    ll res=INT_MAX;
    for(ll n=x;n<=y;n++)
    {
        for(ll k=n+1;k<=y;k++)
        {
            res=min(res,((n%2019)*(k%2019))%2019);
        }
    }
    cout<<res;
}