import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
 * https://qiita.com/drken/items/fd4e5e3630d0f5859067
 * @author YukihiroLocal
 *
 */
public class Main {
  public static void main(String[] args) {


    Scanner sc = new Scanner(System.in);
    // get a integer

    int N = sc.nextInt();
//    System.out.println(" integer is " + N);
    List<Integer> aList = new ArrayList<>();
    List<Integer> divideList = new ArrayList<>();
    int Y = sc.nextInt();
    int ansx = -1, ansy = -1, ansz = -1;
//    Y = 10000 * x + 5000 * y + 1000 *z;
//    N = x + y + z;
//    z = N - x - y;
//    z = (Y - (10000 * x + 5000 * y)) /1000;


    for(int x = 0; x <= N ; x++){
      // i is equal to x
      double caluculatedY = getCalY(x, N,  Y);
      double caluculatedZ = N -x - caluculatedY;
      if(validateAll(caluculatedY,caluculatedZ, N)){
        ansx = x;
        ansy = (int)caluculatedY;
        ansz = (int)caluculatedZ;
        break;
      }
    }
    System.out.println(ansx + " " + ansy + " " + ansz);

  };
  private static double getCalY(int x,int N, int Y) {
//    Y = 10000 * x + 5000 * y + 1000 * (N - x - y);
//    Y = 10000 * x + 5000 * y + 1000 *N - 1000* x - 1000* y;
//    Y = 9000*x + 4000*y + 1000*N
//
    double y = ((double)Y - 9000 * (double)x  - 1000* (double)N ) /4000;
    return y;
  }

  public static boolean validate(double a, double N) {
    if(a ==(int)a && a >= 0 && a <= N){
      return true;
    }else{
      return false;
    }
  }
  public static boolean validateAll(double y, double z, int N) {
    boolean yflag = false, zflag = false;
    if(validate(y, N)){
      yflag = true;
    };
    if(validate(z, N)){
      zflag = true;
    }
    return yflag && zflag;
  }
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) {


    Scanner sc = new Scanner(System.in);
    // get a integer

    int N = sc.nextInt();
//    System.out.println(" integer is " + N);
    List<Integer> aList = new ArrayList<>();
    List<Integer> divideList = new ArrayList<>();
    int Y = sc.nextInt();
    int ansx = -1, ansy = -1, ansz = -1;
//    Y = 10000 * x + 5000 * y + 1000 *z;
//    N = x + y + z;
//    z = N - x - y;
//    z = (Y - (10000 * x + 5000 * y)) /1000;


    for(int x = 0; x <= N ; x++){
      // i is equal to x
      double caluculatedY = getCalY(x, N,  Y);
      double caluculatedZ = N -x - caluculatedY;
      if(validateAll(caluculatedY,caluculatedZ, N)){
        ansx = x;
        ansy = (int)caluculatedY;
        ansz = (int)caluculatedZ;
        break;
      }
    }
    System.out.println(ansx + " " + ansy + " " + ansz);

  };
  private static double getCalY(int x,int N, int Y) {
//    Y = 10000 * x + 5000 * y + 1000 * (N - x - y);
//    Y = 10000 * x + 5000 * y + 1000 *N - 1000* x - 1000* y;
//    Y = 9000*x + 4000*y + 1000*N
//
    double y = ((double)Y - 9000 * (double)x  - 1000* (double)N ) /4000;
    return y;
  }

  public static boolean validate(double a, double N) {
    if(a ==(int)a && a >= 0 && a <= N){
      return true;
    }else{
      return false;
    }
  }
  public static boolean validateAll(double y, double z, int N) {
    boolean yflag = false, zflag = false;
    if(validate(y, N)){
      yflag = true;
    };
    if(validate(z, N)){
      zflag = true;
    }
    return yflag && zflag;
  }
} Main public static void main(String[] args) {


    Scanner sc = new Scanner(System.in);
    // get a integer

    int N = sc.nextInt();
//    System.out.println(" integer is " + N);
    List<Integer> aList = new ArrayList<>();
    List<Integer> divideList = new ArrayList<>();
    int Y = sc.nextInt();
    int ansx = -1, ansy = -1, ansz = -1;
//    Y = 10000 * x + 5000 * y + 1000 *z;
//    N = x + y + z;
//    z = N - x - y;
//    z = (Y - (10000 * x + 5000 * y)) /1000;


    for(int x = 0; x <= N ; x++){
      // i is equal to x
      double caluculatedY = getCalY(x, N,  Y);
      double caluculatedZ = N -x - caluculatedY;
      if(validateAll(caluculatedY,caluculatedZ, N)){
        ansx = x;
        ansy = (int)caluculatedY;
        ansz = (int)caluculatedZ;
        break;
      }
    }
    System.out.println(ansx + " " + ansy + " " + ansz);

  } main {


    Scanner sc = new Scanner(System.in);
    // get a integer

    int N = sc.nextInt();
//    System.out.println(" integer is " + N);
    List<Integer> aList = new ArrayList<>();
    List<Integer> divideList = new ArrayList<>();
    int Y = sc.nextInt();
    int ansx = -1, ansy = -1, ansz = -1;
//    Y = 10000 * x + 5000 * y + 1000 *z;
//    N = x + y + z;
//    z = N - x - y;
//    z = (Y - (10000 * x + 5000 * y)) /1000;


    for(int x = 0; x <= N ; x++){
      // i is equal to x
      double caluculatedY = getCalY(x, N,  Y);
      double caluculatedZ = N -x - caluculatedY;
      if(validateAll(caluculatedY,caluculatedZ, N)){
        ansx = x;
        ansy = (int)caluculatedY;
        ansz = (int)caluculatedZ;
        break;
      }
    }
    System.out.println(ansx + " " + ansy + " " + ansz);

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc List<Integer> aList = new ArrayList<>(); aList new ArrayList<>() List<Integer> divideList = new ArrayList<>(); divideList new ArrayList<>() int Y = sc.nextInt(); Y sc.nextInt() sc.nextInt sc int ansx = -1 ansx -1 1 ansy = -1 ansy -1 1 ansz = -1; ansz -1 1 for(int x = 0; x <= N ; x++){
      // i is equal to x
      double caluculatedY = getCalY(x, N,  Y);
      double caluculatedZ = N -x - caluculatedY;
      if(validateAll(caluculatedY,caluculatedZ, N)){
        ansx = x;
        ansy = (int)caluculatedY;
        ansz = (int)caluculatedZ;
        break;
      }
    } int x = 0; int x = 0; x 0 x <= N x N x++ x++ x {
      // i is equal to x
      double caluculatedY = getCalY(x, N,  Y);
      double caluculatedZ = N -x - caluculatedY;
      if(validateAll(caluculatedY,caluculatedZ, N)){
        ansx = x;
        ansy = (int)caluculatedY;
        ansz = (int)caluculatedZ;
        break;
      }
    } {
      // i is equal to x
      double caluculatedY = getCalY(x, N,  Y);
      double caluculatedZ = N -x - caluculatedY;
      if(validateAll(caluculatedY,caluculatedZ, N)){
        ansx = x;
        ansy = (int)caluculatedY;
        ansz = (int)caluculatedZ;
        break;
      }
    } double caluculatedY = getCalY(x, N,  Y); caluculatedY getCalY(x, N,  Y) getCalY x N Y double caluculatedZ = N -x - caluculatedY; caluculatedZ N -x - caluculatedY N -x - caluculatedY N x caluculatedY if(validateAll(caluculatedY,caluculatedZ, N)){
        ansx = x;
        ansy = (int)caluculatedY;
        ansz = (int)caluculatedZ;
        break;
      } validateAll(caluculatedY,caluculatedZ, N) validateAll caluculatedY caluculatedZ N {
        ansx = x;
        ansy = (int)caluculatedY;
        ansz = (int)caluculatedZ;
        break;
      } ansx = x ansx x ansy = (int)caluculatedY ansy (int)caluculatedY ansz = (int)caluculatedZ ansz (int)caluculatedZ break; System.out.println(ansx + " " + ansy + " " + ansz) System.out.println System.out System System.out ansx + " " + ansy + " " + ansz " " ansy ansx + " " + ansy + " " + ansz ansx " " ansy " " ansz String[] args args private static double getCalY(int x,int N, int Y) {
//    Y = 10000 * x + 5000 * y + 1000 * (N - x - y);
//    Y = 10000 * x + 5000 * y + 1000 *N - 1000* x - 1000* y;
//    Y = 9000*x + 4000*y + 1000*N
//
    double y = ((double)Y - 9000 * (double)x  - 1000* (double)N ) /4000;
    return y;
  } getCalY {
//    Y = 10000 * x + 5000 * y + 1000 * (N - x - y);
//    Y = 10000 * x + 5000 * y + 1000 *N - 1000* x - 1000* y;
//    Y = 9000*x + 4000*y + 1000*N
//
    double y = ((double)Y - 9000 * (double)x  - 1000* (double)N ) /4000;
    return y;
  } double y = ((double)Y - 9000 * (double)x  - 1000* (double)N ) /4000; y ((double)Y - 9000 * (double)x  - 1000* (double)N ) /4000 ((double)Y - 9000 * (double)x  - 1000* (double)N ) (double)Y - 9000 * (double)x  - 1000* (double)N (double)Y 9000 * (double)x 9000 (double)x 1000* (double)N 1000 (double)N 4000 return y; y int x x int N N int Y Y public static boolean validate(double a, double N) {
    if(a ==(int)a && a >= 0 && a <= N){
      return true;
    }else{
      return false;
    }
  } validate {
    if(a ==(int)a && a >= 0 && a <= N){
      return true;
    }else{
      return false;
    }
  } if(a ==(int)a && a >= 0 && a <= N){
      return true;
    }else{
      return false;
    } a ==(int)a && a >= 0 && a <= N a ==(int)a && a >= 0 && a <= N a ==(int)a a (int)a a >= 0 a 0 a <= N a N {
      return true;
    } return true; true {
      return false;
    } return false; false double a a double N N public static boolean validateAll(double y, double z, int N) {
    boolean yflag = false, zflag = false;
    if(validate(y, N)){
      yflag = true;
    };
    if(validate(z, N)){
      zflag = true;
    }
    return yflag && zflag;
  } validateAll {
    boolean yflag = false, zflag = false;
    if(validate(y, N)){
      yflag = true;
    };
    if(validate(z, N)){
      zflag = true;
    }
    return yflag && zflag;
  } boolean yflag = false yflag false zflag = false; zflag false if(validate(y, N)){
      yflag = true;
    } validate(y, N) validate y N {
      yflag = true;
    } yflag = true yflag true if(validate(z, N)){
      zflag = true;
    } validate(z, N) validate z N {
      zflag = true;
    } zflag = true zflag true return yflag && zflag; yflag && zflag yflag zflag double y y double z z int N N public class Main {
  public static void main(String[] args) {


    Scanner sc = new Scanner(System.in);
    // get a integer

    int N = sc.nextInt();
//    System.out.println(" integer is " + N);
    List<Integer> aList = new ArrayList<>();
    List<Integer> divideList = new ArrayList<>();
    int Y = sc.nextInt();
    int ansx = -1, ansy = -1, ansz = -1;
//    Y = 10000 * x + 5000 * y + 1000 *z;
//    N = x + y + z;
//    z = N - x - y;
//    z = (Y - (10000 * x + 5000 * y)) /1000;


    for(int x = 0; x <= N ; x++){
      // i is equal to x
      double caluculatedY = getCalY(x, N,  Y);
      double caluculatedZ = N -x - caluculatedY;
      if(validateAll(caluculatedY,caluculatedZ, N)){
        ansx = x;
        ansy = (int)caluculatedY;
        ansz = (int)caluculatedZ;
        break;
      }
    }
    System.out.println(ansx + " " + ansy + " " + ansz);

  };
  private static double getCalY(int x,int N, int Y) {
//    Y = 10000 * x + 5000 * y + 1000 * (N - x - y);
//    Y = 10000 * x + 5000 * y + 1000 *N - 1000* x - 1000* y;
//    Y = 9000*x + 4000*y + 1000*N
//
    double y = ((double)Y - 9000 * (double)x  - 1000* (double)N ) /4000;
    return y;
  }

  public static boolean validate(double a, double N) {
    if(a ==(int)a && a >= 0 && a <= N){
      return true;
    }else{
      return false;
    }
  }
  public static boolean validateAll(double y, double z, int N) {
    boolean yflag = false, zflag = false;
    if(validate(y, N)){
      yflag = true;
    };
    if(validate(z, N)){
      zflag = true;
    }
    return yflag && zflag;
  }
} public class Main {
  public static void main(String[] args) {


    Scanner sc = new Scanner(System.in);
    // get a integer

    int N = sc.nextInt();
//    System.out.println(" integer is " + N);
    List<Integer> aList = new ArrayList<>();
    List<Integer> divideList = new ArrayList<>();
    int Y = sc.nextInt();
    int ansx = -1, ansy = -1, ansz = -1;
//    Y = 10000 * x + 5000 * y + 1000 *z;
//    N = x + y + z;
//    z = N - x - y;
//    z = (Y - (10000 * x + 5000 * y)) /1000;


    for(int x = 0; x <= N ; x++){
      // i is equal to x
      double caluculatedY = getCalY(x, N,  Y);
      double caluculatedZ = N -x - caluculatedY;
      if(validateAll(caluculatedY,caluculatedZ, N)){
        ansx = x;
        ansy = (int)caluculatedY;
        ansz = (int)caluculatedZ;
        break;
      }
    }
    System.out.println(ansx + " " + ansy + " " + ansz);

  };
  private static double getCalY(int x,int N, int Y) {
//    Y = 10000 * x + 5000 * y + 1000 * (N - x - y);
//    Y = 10000 * x + 5000 * y + 1000 *N - 1000* x - 1000* y;
//    Y = 9000*x + 4000*y + 1000*N
//
    double y = ((double)Y - 9000 * (double)x  - 1000* (double)N ) /4000;
    return y;
  }

  public static boolean validate(double a, double N) {
    if(a ==(int)a && a >= 0 && a <= N){
      return true;
    }else{
      return false;
    }
  }
  public static boolean validateAll(double y, double z, int N) {
    boolean yflag = false, zflag = false;
    if(validate(y, N)){
      yflag = true;
    };
    if(validate(z, N)){
      zflag = true;
    }
    return yflag && zflag;
  }
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
 * https://qiita.com/drken/items/fd4e5e3630d0f5859067
 * @author YukihiroLocal
 *
 */
public class Main {
  public static void main(String[] args) {


    Scanner sc = new Scanner(System.in);
    // get a integer

    int N = sc.nextInt();
//    System.out.println(" integer is " + N);
    List<Integer> aList = new ArrayList<>();
    List<Integer> divideList = new ArrayList<>();
    int Y = sc.nextInt();
    int ansx = -1, ansy = -1, ansz = -1;
//    Y = 10000 * x + 5000 * y + 1000 *z;
//    N = x + y + z;
//    z = N - x - y;
//    z = (Y - (10000 * x + 5000 * y)) /1000;


    for(int x = 0; x <= N ; x++){
      // i is equal to x
      double caluculatedY = getCalY(x, N,  Y);
      double caluculatedZ = N -x - caluculatedY;
      if(validateAll(caluculatedY,caluculatedZ, N)){
        ansx = x;
        ansy = (int)caluculatedY;
        ansz = (int)caluculatedZ;
        break;
      }
    }
    System.out.println(ansx + " " + ansy + " " + ansz);

  };
  private static double getCalY(int x,int N, int Y) {
//    Y = 10000 * x + 5000 * y + 1000 * (N - x - y);
//    Y = 10000 * x + 5000 * y + 1000 *N - 1000* x - 1000* y;
//    Y = 9000*x + 4000*y + 1000*N
//
    double y = ((double)Y - 9000 * (double)x  - 1000* (double)N ) /4000;
    return y;
  }

  public static boolean validate(double a, double N) {
    if(a ==(int)a && a >= 0 && a <= N){
      return true;
    }else{
      return false;
    }
  }
  public static boolean validateAll(double y, double z, int N) {
    boolean yflag = false, zflag = false;
    if(validate(y, N)){
      yflag = true;
    };
    if(validate(z, N)){
      zflag = true;
    }
    return yflag && zflag;
  }
}
