#![allow(unused_imports)]
use std::io::*;
use std::cmp::*;
use std::collections::*;

macro_rules! debug(
    ($($arg:tt)*) => { {
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

struct Scanner {
   buffer : std::collections::VecDeque<String>
}

impl Scanner {

   fn new() -> Scanner {
      Scanner {
         buffer: std::collections::VecDeque::new()
      }
   }

   fn next<T : std::str::FromStr >(&mut self) -> T {

      if self.buffer.len() == 0 {
         let mut input = String::new();
         std::io::stdin().read_line(&mut input).ok();
         for word in input.split_whitespace() {
            self.buffer.push_back(word.to_string())
         }
      }

      let front = self.buffer.pop_front().unwrap();
      front.parse::<T>().ok().unwrap()
   }
}

fn checked_sub(a : usize, b : usize) -> usize {
   if b > a {
      println!("Checked sub failed!, {}, {}", a, b);
   }
   a - b
}

fn main() {
   let mut s = Scanner::new();
   let buffer : String = s.next();
   let mut input = buffer.into_bytes();

   let mut set : [i32; 30] = [0; 30];
   let mut count = 0;
   let mut left = 0;
   let mut right = 26;
   let b = 'A' as usize;

   if input.len() < 26 {
      println!("-1");
      return;
   }

   for i in left..right {
      let c = input[i] as char;
      let k = input[i] as usize;
      if c == '?' {
         count += 1;
         set[26] += 1;
      } else {

         if set[checked_sub(k, b)] == 0 {
            count += 1;
         }
         set[checked_sub(k, b)] += 1;
      }
   }

   let mut tail = input[left] as usize;
   for i in right..input.len() {
      let c = input[i] as char;
      let k = input[i] as usize;

      if count == 26 {
         break;
      }

      if tail == '?' as usize {
         set[26] -= 1;
         count -= 1;
      } else {
         set[checked_sub(tail, b)] -= 1;
         if set[checked_sub(tail, b)] == 0 {
            count -= 1;
         }
      }

      if c == '?' {
         count += 1;
         set[26] += 1;
      } else {
         if set[checked_sub(k, b)] == 0 {
            count += 1;
         }
         set[checked_sub(k, b)] += 1;
      }

      left += 1;
      right += 1;
      tail = input[left] as usize;
   }

   if count == 26 {

      for i in 0..left {
         let c = input[i] as char;
         if c == '?' {
            input[i] = 'A' as u8;
         }
      }

      for i in left..right {
         let c = input[i] as char;
         if c == '?' {
            for j in 0..27 {
               if set[j] == 0 {
                  let k = j as u8;
                  input[i] = k + b as u8;
                  set[j] = 1;
                  break;
               }
            }
         }
      }

      for i in right..input.len() {
         let c = input[i] as char;
         if c == '?' {
            input[i] = 'A' as u8;
         }
      }

      for i in input.iter() {
         print!("{}", *i as char);
      }
      println!("");
   } else {
      println!("-1");
   }
}

#![allow(unused_imports)]
use std::io::*;
use std::cmp::*;
use std::collections::*;

macro_rules! debug(
    ($($arg:tt)*) => { {
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

fn main() {
   let mut buffer : String = String::new();
   stdin().read_line(&mut buffer).ok();
   let mut input = buffer.trim().to_string().into_bytes();

   let mut set : [i32; 30] = [0; 30];
   let mut count = 0;
   let mut left = 0;
   let mut right = 26;
   let b = 'A' as usize;

   if input.len() < 26 {
      println!("-1");
      return;
   }

   for i in left..right {
      let c = input[i] as char;
      let k = input[i] as usize;
      if c == '?' {
         count += 1;
         set[26] += 1;
      } else {

         if set[k - b] == 0 {
            count += 1;
         }
         set[k - b] += 1;
      }
   }

   let mut tail = input[left] as usize;
   for i in right..input.len() {
      let c = input[i] as char;
      let k = input[i] as usize;

      if count == 26 {
         break;
      }

      if tail == '?' as usize {
         set[26] -= 1;
         count -= 1;
      } else {
         set[tail - b] -= 1;
         if set[tail - b] == 0 {
            count -= 1;
         }
      }

      if c == '?' {
         count += 1;
         set[26] += 1;
      } else {
         if set[k - b] == 0 {
            count += 1;
         }
         set[k - b] += 1;
      }

      left += 1;
      right += 1;
      tail = input[left] as usize;
   }

   if count == 26 {

      for i in 0..left {
         let c = input[i] as char;
         if c == '?' {
            input[i] = 'A' as u8;
         }
      }

      for i in left..right {
         let c = input[i] as char;
         if c == '?' {
            for j in 0..27 {
               if set[j] == 0 {
                  let k = j as u8;
                  input[i] = k + b as u8;
                  set[j] = 1;
                  break;
               }
            }
         }
      }

      for i in right..input.len() {
         let c = input[i] as char;
         if c == '?' {
            input[i] = 'A' as u8;
         }
      }

      for i in input.iter() {
         print!("{}", *i as char);
      }
      println!("");
   } else {
      println!("-1");
   }
}

use std::io::prelude::*;
use std::io;
use std::str;

fn main() {
    let stdin = io::stdin();
    let mut s = stdin.lock().lines().next().unwrap().unwrap();

    is_nice_word(&s);
}

fn is_nice_word(s: &String) {

    // list of the last position each letter A-Z was seen
    let mut laspos = [-1i32; 26];
    let mut laschr : Vec<char> = vec![];
    //how many wildcards '?' there were in the last 26 characters
    let mut wildcd = 0;

    for (i, ch) in s.chars().enumerate() {
        laschr.push(ch);

        match ch {
            '?' => {
                wildcd += 1;
            },
            chr => {
                laspos[((chr as u8) - ('A' as u8)) as usize] = i as i32;
            }
        }

        if i > 25 {
            match laschr.remove(0) {
                '?' => {
                    wildcd -= 1;
                },
                _ => ()
            }
        }

        // count how many letters occur in the last 26 characters and store the ones that didn't
        // also keep track of how many wildcards we have seen
        let mut count = 0;
        let mut letters : Vec<char>= vec![];
        for j in 0..26 {
            if laspos[j] != -1 && i - (laspos[j] as usize) < 26 {
                count += 1;
            } else {
                letters.push((('A' as u8) + j as u8) as char);
            }
        }

        //If we have seen enough characters and wildcards, print out the string
        if count + wildcd >= 26 {

            let mut output = String::new();

            for chr in s.chars().take(i-25) {
                //print 'A' in the question mark spots before the substring
                match chr {
                    '?' => {
                        output.push('A');
                    },
                    c => {
                        output.push(c);
                    }
                }
            }

            for chr in s.chars().skip(i-25) {

                //print missing letters in the question mark spots
                match chr {
                    '?' => {
                        output.push(letters.pop().unwrap_or('Z'));
                    },
                    c => {
                        output.push(c);
                    }
                }
            }

            println!("{}", output);
            return;
        }

    }

    println!("-1");
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main(){

    let cs: Vec<char> = get_line().chars().collect();
    let len = cs.len();

    if len < 26 {
        println!("-1");
        return;
    }

    for i in 0..len-25 {
        let mut freq: Vec<usize> = vec![0;26];
        for j in i..i+26 {
            if cs[j] == '?' {
                continue;
            }
            let c = cs[j] as usize - 'A' as usize;
            freq[c] += 1;
        }

        if freq.iter().any(|&x: &usize| x > 1) {
            continue;
        }

        for j in 0..i {
            print!("{}", if cs[j] == '?' { 'A' } else { cs[j] })
        }

        for j in i..i+26 {
            if cs[j] != '?' {
                print!("{}", cs[j]);
            } else {
                for k in 0..26 {
                    if freq[k] == 0 {
                        print!("{}", (k as u8 + 'A' as u8) as char);
                        freq[k] = 1;
                        break;
                    }
                }
            }
        }

        for j in i+26..len {
            print!("{}", if cs[j] == '?' { 'A' } else { cs[j] })
        }
        return;
    }

    println!("-1")
}

#[allow(dead_code)]
fn get_line() -> String{
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_string()
}

#[allow(dead_code)]
fn readln<T: Read>() -> T{
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    T::read(buf.trim_right())
}

trait Read{
    fn read(s: &str) -> Self;
}

macro_rules! read_impl{
    ($($t:ty)*) => ($(
        impl Read for $t {
            fn read(s: &str) -> $t{
                s.parse().unwrap()
            }
        }
    )*)
}
read_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }

impl<T: Read> Read for Vec<T>{
    fn read(s: &str) -> Self {
        s.split_whitespace().map(T::read).collect()
    }
}

impl<A: Read, B: Read> Read for (A, B){
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]))
    }
}

impl<A: Read, B: Read, C: Read> Read for (A, B, C){
    fn read(s: &str) -> Self {
        let tokens: Vec<_> = s.split_whitespace().collect();
        (A::read(tokens[0]), B::read(tokens[1]), C::read(tokens[2]))
    }
}

use std::io::prelude::*;
use std::io;

fn main() {
    let stdin = io::stdin();
    let mut s = stdin.lock().lines().next().unwrap().unwrap();

    is_nice_word(&s);
}

fn is_nice_word(s: &String) {

    // list of the last position each letter A-Z was seen
    let mut laspos = [(s.len()); 26];
    //how many wildcards '?' there were in the last 26 characters
    let mut wildcd = 0;

    for i in 0..(s.len()) {
        match s.chars().skip(i).next().unwrap() {
            '?' => {
                wildcd += 1;
            },
            chr => {
                laspos[((chr as u8) - ('A' as u8)) as usize] = i;
            }
        }

        if i > 26 {
            match s.chars().skip(i-26).next().unwrap() {
                '?' => {
                    wildcd -= 1;
                },
                _ => ()
            }
        }

        // count how many letters occur in the last 26 characters and remember the ones that didn't
        // also keep track of how many wildcards we have seen
        let mut count = 0;
        let mut letters : Vec<char>= vec![];
        for j in 0..26 {
            if i - laspos[j] < 26 {
                count += 1;
            } else {
                letters.push((('A' as u8) + j as u8) as char);
            }
        }

        //If we have seen enough characters and wildcards, print out the string.
        if count + wildcd >= 26 {
            for chr in s.chars().skip(i-25).take(26) {
                match chr {
                    '?' => {
                        print!("{}", letters.pop().unwrap_or('?'));
                    },
                    c => {
                        print!("{}", c);
                    }
                }
            }
            println!("");
            return;
        }

    }

    println!("-1");
}

use std::io::prelude::*;
use std::io;

fn main() {
    let stdin = io::stdin();
    let mut s = stdin.lock().lines().next().unwrap().unwrap();

    is_nice_word(&s);
}

fn is_nice_word(s: &String) {

    // list of the last position each letter A-Z was seen
    let mut laspos = [(s.len()+27); 26];
    //how many wildcards '?' there were in the last 26 characters
    let mut wildcd = 0;

    for i in 0..(s.len()) {
        match s.chars().skip(i).next().unwrap() {
            '?' => {
                wildcd += 1;
            },
            chr => {
                laspos[((chr as u8) - ('A' as u8)) as usize] = i;
            }
        }

        if i > 26 {
            match s.chars().skip(i-26).next().unwrap() {
                '?' => {
                    wildcd -= 1;
                },
                _ => ()
            }
        }

        // count how many letters occur in the last 26 characters and remember the ones that didn't
        // also keep track of how many wildcards we have seen
        let mut count = 0;
        let mut letters : Vec<char>= vec![];
        for j in 0..26 {
            if i - laspos[j] < 26 {
                count += 1;
            } else {
                letters.push((('A' as u8) + j as u8) as char);
            }
        }

        //If we have seen enough characters and wildcards, print out the string.
        if count + wildcd >= 26 {
            for chr in s.chars().skip(i-25).take(26) {
                match chr {
                    '?' => {
                        print!("{}", letters.pop().unwrap_or('?'));
                    },
                    c => {
                        print!("{}", c);
                    }
                }
            }
            println!("");
            return;
        }

    }

    println!("-1");
}

use std::io::prelude::*;
use std::io;

fn main() {
    let stdin = io::stdin();
    let mut s = stdin.lock().lines().next().unwrap().unwrap();

    is_nice_word(&s);
}

fn is_nice_word(s: &String) {

    // list of the last position each letter A-Z was seen
    let mut laspos = [-1i32; 26];
    //how many wildcards '?' there were in the last 26 characters
    let mut wildcd = 0;

    for i in 0..(s.len()) {
        match s.chars().skip(i).next().unwrap() {
            '?' => {
                wildcd += 1;
            },
            chr => {
                laspos[((chr as u8) - ('A' as u8)) as usize] = i as i32;
            }
        }

        if i > 26 {
            match s.chars().skip(i-26).next().unwrap() {
                '?' => {
                    wildcd -= 1;
                },
                _ => ()
            }
        }

        // count how many letters occur in the last 26 characters and remember the ones that didn't
        // also keep track of how many wildcards we have seen
        let mut count = 0;
        let mut letters : Vec<char>= vec![];
        for j in 0..26 {
            if laspos[j] != -1 && i - (laspos[j] as usize) < 26 {
                count += 1;
            } else {
                letters.push((('A' as u8) + j as u8) as char);
            }
        }

        //If we have seen enough characters and wildcards, print out the string.
        if count + wildcd >= 26 {
            for chr in s.chars().skip(i-25).take(26) {
                //print missing letters in the question mark spots
                match chr {
                    '?' => {
                        print!("{}", letters.pop().unwrap_or('?'));
                    },
                    c => {
                        print!("{}", c);
                    }
                }
            }
            println!("");
            return;
        }

    }

    println!("-1");
}

use std::io::prelude::*;
use std::io;
use std::str;

fn main() {
    let stdin = io::stdin();
    let mut s = stdin.lock().lines().next().unwrap().unwrap();

    is_nice_word(&s);
}

fn is_nice_word(s: &String) {

    // list of the last position each letter A-Z was seen
    let mut laspos = [-1i32; 26];
    let mut laschr : Vec<char> = vec![];
    //how many wildcards '?' there were in the last 26 characters
    let mut wildcd = 0;

    for (i, ch) in s.chars().enumerate() {
        laschr.push(ch);

        match ch {
            '?' => {
                wildcd += 1;
            },
            chr => {
                laspos[((chr as u8) - ('A' as u8)) as usize] = i as i32;
            }
        }

        if i > 26 {
            match laschr.remove(0) {
                '?' => {
                    wildcd -= 1;
                },
                _ => ()
            }
        }

        // count how many letters occur in the last 26 characters and remember the ones that didn't
        // also keep track of how many wildcards we have seen
        let mut count = 0;
        let mut letters : Vec<char>= vec![];
        for j in 0..26 {
            if laspos[j] != -1 && i - (laspos[j] as usize) < 26 {
                count += 1;
            } else {
                letters.push((('A' as u8) + j as u8) as char);
            }
        }

        //If we have seen enough characters and wildcards, print out the string
        if count + wildcd >= 26 {

            let mut output = String::new();

            for chr in s.chars().take(i-25) {
                //print 'A' in the question mark spots before the substring
                match chr {
                    '?' => {
                        output.push('A');
                    },
                    c => {
                        output.push(c);
                    }
                }
            }

            for chr in s.chars().skip(i-25) {

                //print missing letters in the question mark spots
                match chr {
                    '?' => {
                        output.push(letters.pop().unwrap_or('Z'));
                    },
                    c => {
                        output.push(c);
                    }
                }
            }

            println!("{}", output);
            return;
        }

    }

    println!("-1");
}

use std::io::prelude::*;
use std::io;

fn main() {
    let stdin = io::stdin();
    let mut s = stdin.lock().lines().next().unwrap().unwrap();

    is_nice_word(&s);
}

fn is_nice_word(s: &String) {

    // list of the last position each letter A-Z was seen
    let mut laspos = [-1i32; 26];
    //how many wildcards '?' there were in the last 26 characters
    let mut wildcd = 0;

    for i in 0..(s.len()) {
        match s.chars().skip(i).next().unwrap() {
            '?' => {
                wildcd += 1;
            },
            chr => {
                laspos[((chr as u8) - ('A' as u8)) as usize] = i as i32;
            }
        }

        if i > 26 {
            match s.chars().skip(i-26).next().unwrap() {
                '?' => {
                    wildcd -= 1;
                },
                _ => ()
            }
        }

        // count how many letters occur in the last 26 characters and remember the ones that didn't
        // also keep track of how many wildcards we have seen
        let mut count = 0;
        let mut letters : Vec<char>= vec![];
        for j in 0..26 {
            if laspos[j] != -1 && i - (laspos[j] as usize) < 26 {
                count += 1;
            } else {
                letters.push((('A' as u8) + j as u8) as char);
            }
        }

        //If we have seen enough characters and wildcards, print out the string.
        if count + wildcd >= 26 {

            for chr in s.chars().take(i-25) {
                //print missing letters in the question mark spots
                match chr {
                    '?' => {
                        print!("A");
                    },
                    c => {
                        print!("{}", c);
                    }
                }
            }

            for chr in s.chars().skip(i-25).take(26) {
                //print missing letters in the question mark spots
                match chr {
                    '?' => {
                        print!("{}", letters.pop().unwrap_or('?'));
                    },
                    c => {
                        print!("{}", c);
                    }
                }
            }

            for chr in s.chars().skip(i) {
                //print missing letters in the question mark spots
                match chr {
                    '?' => {
                        print!("A");
                    },
                    c => {
                        print!("{}", c);
                    }
                }
            }
            println!("");
            return;
        }

    }

    println!("-1");
}

use std::io::prelude::*;
use std::io;
use std::str;

fn main() {
    let stdin = io::stdin();
    let mut s = stdin.lock().lines().next().unwrap().unwrap();

    is_nice_word(&s);
}

fn is_nice_word(s: &String) {

    // list of the last position each letter A-Z was seen
    let mut laspos = [-1i32; 26];
    let mut laschr : Vec<char> = vec![];
    //how many wildcards '?' there were in the last 26 characters
    let mut wildcd = 0;

    for (i, ch) in s.chars().enumerate() {
        laschr.push(ch);

        match ch {
            '?' => {
                wildcd += 1;
            },
            chr => {
                laspos[((chr as u8) - ('A' as u8)) as usize] = i as i32;
            }
        }

        if i > 26 {
            match laschr.remove(0) {
                '?' => {
                    wildcd -= 1;
                },
                _ => ()
            }
        }

        // count how many letters occur in the last 26 characters and remember the ones that didn't
        // also keep track of how many wildcards we have seen
        let mut count = 0;
        let mut letters : Vec<char>= vec![];
        for j in 0..26 {
            if laspos[j] != -1 && i - (laspos[j] as usize) < 26 {
                count += 1;
            } else {
                letters.push((('A' as u8) + j as u8) as char);
            }
        }

        //If we have seen enough characters and wildcards, print out the string
        if count + wildcd >= 26 {

            let mut output = String::new();

            for chr in s.chars().take(i-25) {
                //print 'A' in the question mark spots before the substring
                match chr {
                    '?' => {
                        output.push('A');
                    },
                    c => {
                        output.push(c);
                    }
                }
            }

            for chr in s.chars().skip(i-25).take(26) {

                //print missing letters in the question mark spots
                match chr {
                    '?' => {
                        output.push(letters.pop().unwrap_or('?'));
                    },
                    c => {
                        output.push(c);
                    }
                }
            }

            for chr in s.chars().skip(i+1) {

                //print 'Z' in the question mark spots after the substring
                match chr {
                    '?' => {
                        output.push('Z');
                    },
                    c => {
                        output.push(c);
                    }
                }
            }
            println!("{}", output);
            return;
        }

    }

    println!("-1");
}

use std::io::prelude::*;
use std::io;

fn main() {
    let stdin = io::stdin();
    let mut s = stdin.lock().lines().next().unwrap().unwrap();

    is_nice_word(&s);
}

fn is_nice_word(s: &String) {

    // list of the last position each letter A-Z was seen
    let mut laspos = [-1i32; 26];
    let mut laschr : Vec<char> = vec![];
    //how many wildcards '?' there were in the last 26 characters
    let mut wildcd = 0;

    for (i, ch) in s.chars().enumerate() {
        laschr.push(ch);

        match ch {
            '?' => {
                wildcd += 1;
            },
            chr => {
                laspos[((chr as u8) - ('A' as u8)) as usize] = i as i32;
            }
        }

        if i > 26 {
            match laschr.remove(0) {
                '?' => {
                    wildcd -= 1;
                },
                _ => ()
            }
        }

        // count how many letters occur in the last 26 characters and remember the ones that didn't
        // also keep track of how many wildcards we have seen
        let mut count = 0;
        let mut letters : Vec<char>= vec![];
        for j in 0..26 {
            if laspos[j] != -1 && i - (laspos[j] as usize) < 26 {
                count += 1;
            } else {
                letters.push((('A' as u8) + j as u8) as char);
            }
        }

        //If we have seen enough characters and wildcards, print out the string.
        if count + wildcd >= 26 {

            for chr in s.chars().take(i-25) {
                //print missing letters in the question mark spots
                match chr {
                    '?' => {
                        print!("A");
                    },
                    c => {
                        print!("{}", c);
                    }
                }
            }

            for chr in s.chars().skip(i-25).take(26) {

                //print missing letters in the question mark spots
                match chr {
                    '?' => {
                        print!("{}", letters.pop().unwrap_or('?'));
                    },
                    c => {
                        print!("{}", c);
                    }
                }
            }

            for chr in s.chars().skip(i+1) {

                //print missing letters in the question mark spots
                match chr {
                    '?' => {
                        print!("A");
                    },
                    c => {
                        print!("{}", c);
                    }
                }
            }
            println!("");
            return;
        }

    }

    println!("-1");
}

use std::io::prelude::*;
use std::io;

fn main() {
    let stdin = io::stdin();
    let mut s = stdin.lock().lines().next().unwrap().unwrap();

    is_nice_word(&s);
}

fn is_nice_word(s: &String) {

    // list of the last position each letter A-Z was seen
    let mut laspos = [-1i32; 26];
    //how many wildcards '?' there were in the last 26 characters
    let mut wildcd = 0;

    for i in 0..(s.len()) {
        match s.chars().skip(i).next().unwrap() {
            '?' => {
                wildcd += 1;
            },
            chr => {
                laspos[((chr as u8) - ('A' as u8)) as usize] = i as i32;
            }
        }

        if i > 26 {
            match s.chars().skip(i-26).next().unwrap() {
                '?' => {
                    wildcd -= 1;
                },
                _ => ()
            }
        }

        // count how many letters occur in the last 26 characters and remember the ones that didn't
        // also keep track of how many wildcards we have seen
        let mut count = 0;
        let mut letters : Vec<char>= vec![];
        for j in 0..26 {
            if laspos[j] != -1 && i - (laspos[j] as usize) < 26 {
                count += 1;
            } else {
                letters.push((('A' as u8) + j as u8) as char);
            }
        }

        //If we have seen enough characters and wildcards, print out the string.
        if count + wildcd >= 26 {
            for chr in s.chars().skip(i-25).take(26) {
                match chr {
                    '?' => {
                        print!("{}", letters.pop().unwrap_or('?'));
                    },
                    c => {
                        print!("{}", c);
                    }
                }
            }
            println!("");
            return;
        }

    }

    println!("-1");
}

#![allow(unused_imports)]
use std::io::*;
use std::cmp::*;
use std::collections::*;

macro_rules! debug(
    ($($arg:tt)*) => { {
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

struct Scanner {
   buffer : std::collections::VecDeque<String>
}

impl Scanner {

   fn new() -> Scanner {
      Scanner {
         buffer: std::collections::VecDeque::new()
      }
   }

   fn next<T : std::str::FromStr >(&mut self) -> T {

      if self.buffer.len() == 0 {
         let mut input = String::new();
         std::io::stdin().read_line(&mut input).ok();
         for word in input.split_whitespace() {
            self.buffer.push_back(word.to_string())
         }
      }

      let front = self.buffer.pop_front().unwrap();
      front.parse::<T>().ok().unwrap()
   }
}

fn main() {
   let mut s = Scanner::new();
   let input = s.next::<String>();
   let mut set = [0; 27];
   let mut count = 0;
   let mut left = 0;
   let mut right = 26;

   for i in input.chars().take(26) {
      let k = i as usize;
      let b = 'A' as usize;
      if i == '?' {
         count += 1;
         set[26] += 1;
      } else {
         if set[k - b] == 0 {
            count += 1;
         }
         set[k - b] += 1;
      }
   }

   let mut ans : String = input[left..right].to_string();

   let mut tail = input.chars().nth(1).unwrap() as usize;
   for i in input.chars().skip(26) {
      let k = i as usize;
      let b = 'A' as usize;

      if count == 26 {
         ans = input[left..right].to_string();
         break;
      }

      if tail == '?' as usize {
         set[26] -= 1;
         count -= 1;
      } else {
         set[tail - b] -= 1;
         if set[tail - b] == 0 {
            count -= 1;
         }
      }

      if i == '?' {
         count += 1;
         set[26] += 1;
      } else {
         if set[k - b] == 0 {
            count += 1;
         }
         set[k - b] += 1;
      }

      tail = k;
      left += 1;
      right += 1;
   }

   let mut filled : String = String::new();

   for i in ans.chars() {
      let b = 'A' as u8;
      if i == '?' {
         for j in 0..27 {
            if set[j] == 0 {
               let k = j as u8;
               filled.push((k + b) as char);
               set[j] = 1;
               break;
            }
         }
      } else {
         filled.push(i);
      }
   }

   if count == 26 {
      println!("{}", filled);
   } else {
      println!("-1");
   }
}

#![allow(unused_imports)]
use std::io::*;
use std::cmp::*;
use std::collections::*;

macro_rules! debug(
    ($($arg:tt)*) => { {
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

struct Scanner {
   buffer : std::collections::VecDeque<String>
}

impl Scanner {

   fn new() -> Scanner {
      Scanner {
         buffer: std::collections::VecDeque::new()
      }
   }

   fn next<T : std::str::FromStr >(&mut self) -> T {

      if self.buffer.len() == 0 {
         let mut input = String::new();
         std::io::stdin().read_line(&mut input).ok();
         for word in input.split_whitespace() {
            self.buffer.push_back(word.to_string())
         }
      }

      let front = self.buffer.pop_front().unwrap();
      front.parse::<T>().ok().unwrap()
   }
}

fn main() {
   let mut s = Scanner::new();
   let input = s.next::<String>();
   let mut set = [0; 27];
   let mut count = 0;
   let mut left = 0;
   let mut right = 26;

   for i in input.chars().take(26) {
      let k = i as usize;
      let b = 'A' as usize;
      if i == '?' {
         count += 1;
         set[26] += 1;
      } else {
         if set[k - b] == 0 {
            count += 1;
         }
         set[k - b] += 1;
      }
   }

   let mut tail = input.chars().nth(left).unwrap() as usize;
   for i in input.chars().skip(26) {
      let k = i as usize;
      let b = 'A' as usize;

      if count == 26 {
         break;
      }

      if tail == '?' as usize {
         set[26] -= 1;
         count -= 1;
      } else {
         set[tail - b] -= 1;
         if set[tail - b] == 0 {
            count -= 1;
         }
      }

      if i == '?' {
         count += 1;
         set[26] += 1;
      } else {
         if set[k - b] == 0 {
            count += 1;
         }
         set[k - b] += 1;
      }

      left += 1;
      right += 1;
      tail = input.chars().nth(left).unwrap() as usize;
   }

   let mut filled : String = String::new();

   if count == 26 {
      for i in input.chars().take(left) {
         if i == '?' {
            filled.push('A');
         } else {
            filled.push(i);
         }
      }

      for i in input.chars().skip(left).take(right) {
         let b = 'A' as u8;
         if i == '?' {
            for j in 0..27 {
               if set[j] == 0 {
                  let k = j as u8;
                  filled.push((k + b) as char);
                  set[j] = 1;
                  break;
               }
            }
         } else {
            filled.push(i);
         }
      }

      for i in input.chars().skip(left + right) {
         if i == '?' {
            filled.push('A');
         } else {
            filled.push(i);
         }
      }

      println!("{}", filled);
   } else {
      println!("-1");
   }
}


fn main() {
    let mut input = String::new();
    use std::io::{self, prelude::*};
    io::stdin().read_to_string(&mut input).unwrap();

    let mut it = input.split_whitespace();

    let n: u64 = it.next().unwrap().parse().unwrap();
    let x: u64 = it.next().unwrap().parse().unwrap();
    let y: u64 = it.next().unwrap().parse().unwrap();

    let sum = x + y;
    let answer = if sum > n + 1 {
        Answer::Black
    } else {
        Answer::White
    };

    match answer {
        Answer::Black => {
            println!("Black");
        }
        Answer::White => {
            println!("White");
        }
    };
}

enum Answer {
    Black,
    White,
}

fn dist(x:i64,y:i64,x1:i64,y1:i64) -> i64{
    return std::cmp::max((x-x1).abs(), (y-y1).abs());
}

fn read_line() -> Vec<i64>{
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    return input.trim().split(" ").map(|x|{x.parse::<i64>().unwrap()}).collect();
}

fn main(){
    let WHITE = "White";
    let BLACK = "Black";
    let mut line = read_line();
    let n = line[0];
    line = read_line();
    let (x,y) = (line[0],line[1]);
    if dist(1,1,x,y)<=dist(n,n,x,y){
        println!("{}",WHITE);
    }else{
        println!("{}",BLACK);
    }
}

fn dist(x: i64, y: i64) -> i64 {
    return std::cmp::min(x, y) + (x - y).abs();
}

fn read_line() -> Vec<i64> {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    return buf.trim().split(" ").map(|x| { x.parse::<i64>().unwrap() }).collect();
}

fn main() {
    let l1 = read_line();
    let l2 = read_line();
    let n: i64 = l1[0];
    let x: i64 = l2[0];
    let y: i64 = l2[1];
    let d1 = dist(x, y);
    let d2 = dist(n - x + 1, n - y + 1);
    if d2 < d1 {
        println!("Black");
    } else {
        println!("White");
    }
}


// Try Codeforces
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(
        &mut std::io::stdin(),
        &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }

    let n = get!();
    if n == 1 {
        let s = get();
        println!("{}", s);
        return;
    }
    let s = get().as_bytes();
    let mut zeros = 0;
    for &c in s {
        if c== b'0' {
            zeros += 1;
        }
    }
    print!("1");
    for _ in 0..zeros {
        print!("0");
    }
    println!();

}

use std::io::*;
use std::str::FromStr;

fn main() {
    let stdin = stdin();
    let mut sc = Scanner::new(stdin.lock());
    let n = sc.next::<u32>();
    let s = sc.next::<String>();
    let zeros = s.chars().filter(|&c| c == '0').count() as u32;
    let result = std::iter::repeat("0")
        .take(zeros as usize)
        .collect::<String>();
    if n == zeros {
        println!("{}", result);
    } else {
        println!("1{}", result);
    }
}

pub struct Scanner<B> {
    reader: B,
    buffer: Vec<String>,
}

impl<B: BufRead> Scanner<B> {
    pub fn new(reader: B) -> Self {
        Self {
            reader,
            buffer: Vec::new(),
        }
    }

    pub fn next<T: FromStr>(&mut self) -> T
    where
        T::Err: ::std::fmt::Debug,
    {
        if let Some(front) = self.buffer.pop() {
            front.parse::<T>().expect(&front)
        } else {
            let mut input = String::new();
            self.reader.read_line(&mut input).expect("Line not read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
            self.next()
        }
    }
}

use std::io::*;
use std::str::FromStr;

fn main() {
    let stdin = stdin();
    let mut sc = Scanner::new(stdin.lock());
    let n = sc.next::<u32>();
    let s = sc.next::<String>();
    let zeros = s.chars().filter(|&c| c == '0').count() as u32;
    let result = std::iter::repeat("0")
        .take(zeros as usize)
        .collect::<String>();
    println!("1{}", result);
}

pub struct Scanner<B> {
    reader: B,
    buffer: Vec<String>,
}

impl<B: BufRead> Scanner<B> {
    pub fn new(reader: B) -> Self {
        Self {
            reader,
            buffer: Vec::new(),
        }
    }

    pub fn next<T: FromStr>(&mut self) -> T
    where
        T::Err: ::std::fmt::Debug,
    {
        if let Some(front) = self.buffer.pop() {
            front.parse::<T>().expect(&front)
        } else {
            let mut input = String::new();
            self.reader.read_line(&mut input).expect("Line not read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
            self.next()
        }
    }
}


fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let nk: Vec<u32> = s.trim().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    for m in (1..nk[1]).rev() {
        if nk[0] % m == 0 {
            let x = (nk[0] / m) * nk[1] + m;
            println!("{}", x);
            break;
        }
    }
}

#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::{BTreeMap,BTreeSet};
#[allow(unused_imports)]
use std::ops::*;
#[allow(unused_imports)]
use std::collections::BinaryHeap;

#[allow(unused_macros)]
macro_rules! ite {
    ($c:expr, $t:expr, $f:expr) => {{
        if $c { $t } else { $f }
    }};
}

// ref: tanakh <https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8>
// diff: using Parser
#[macro_export]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut parser = Parser::from_str($s);
        input_inner!{parser, $($r)*}
    };
    (parser = $parser:ident, $($r:tt)*) => {
        input_inner!{$parser, $($r)*}
    };
    (new_stdin_parser = $parser:ident, $($r:tt)*) => {
        let stdin = std::io::stdin();
        let reader = std::io::BufReader::new(stdin.lock());
        let mut $parser = Parser::new(reader);
        input_inner!{$parser, $($r)*}
    };
    ($($r:tt)*) => {
        input!{new_stdin_parser = parser, $($r)*}
    };
}

#[macro_export]
macro_rules! input_inner {
    ($parser:ident) => {};
    ($parser:ident, ) => {};
    ($parser:ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($parser, $t);
        input_inner!{$parser $($r)*}
    };
}

#[macro_export]
macro_rules! read_value {
    ($parser:ident, ( $($t:tt),* )) => {
        ( $(read_value!($parser, $t)),* )
    };
    ($parser:ident, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($parser, $t)).collect::<Vec<_>>()
    };
    ($parser:ident, chars) => {
        read_value!($parser, String).chars().collect::<Vec<char>>()
    };
    ($parser:ident, usize1) => {
        read_value!($parser, usize) - 1
    };
    ($parser:ident, $t:ty) => {
        $parser.next::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i64,
        k: i64,
    }
    let mut res = None;
    for right in 1..k {
        if n % right == 0 {
            let left = n / right;
            let x = left * k + right;
            if res.is_none() || res.unwrap() > x {
                res = Some(x);
            }
        }
    }
    println!("{}", res.unwrap());
}

use std::io::BufRead;
use std::io;
use std::str;

// ref: tatsuya6502 <https://qiita.com/tatsuya6502/items/cd448486f7ef7b5b8c7e>
// ref: wariuni <https://qiita.com/tatsuya6502/items/cd448486f7ef7b5b8c7e#comment-7040a5ae96305e884eb9>
// diff: using std::io::BufRead::fill_buf()
pub struct Parser<R> {
    reader: R,
    buf: Vec<u8>,
    pos: usize,
}

impl Parser<io::Empty> {
    pub fn from_str(s: &str) -> Parser<io::Empty> {
        Parser {
            reader: io::empty(),
            buf: s.as_bytes().to_vec(),
            pos: 0,
        }
    }
}

impl<R:BufRead> Parser<R> {
    pub fn new(reader: R) -> Parser<R> {
        Parser {
            reader: reader,
            buf: vec![],
            pos: 0,
        }
    }
    pub fn update_buf(&mut self) {
        self.buf.clear();
        self.pos = 0;
        loop {
            let (len,complete) = {
                let buf2 = self.reader.fill_buf().unwrap();
                self.buf.extend_from_slice(buf2);
                let len = buf2.len();
                (len, buf2[len-1] <= 0x20)
            };
            self.reader.consume(len);
            if complete {
                break;
            }
        }
    }
    pub fn next<T:str::FromStr>(&mut self) -> Result<T, T::Err> {
        loop {
            let mut begin = self.pos;
            while begin < self.buf.len() && (self.buf[begin] <= 0x20) {
                begin += 1;
            }
            let mut end = begin;
            while end < self.buf.len() && (self.buf[end] > 0x20) {
                end += 1;
            }
            if begin != self.buf.len() {
                self.pos = end;
                return str::from_utf8(&self.buf[begin..end]).unwrap().parse::<T>();
            }
            else {
                self.update_buf();
            }
        }
    }
}

use std::fmt::Display;
#[allow(dead_code)]
fn write_vec<T: Display>(xs: &Vec<T>) {
    if xs.len() == 0 {
        println!();
        return;
    }
    print!("{}", xs[0]);
    for i in 1..xs.len() {
        print!(" {}", xs[i]);
    }
    println!();
}

use std::io;

macro_rules! readln {
    () => {{
        use std::io;
        let mut buf = String::new();
        io::stdin().read_line(&mut buf).unwrap();
        buf.trim().to_string()
    }};
    ( $t:ty ) => {{
        let input = readln!();
        input.parse::<$t>().unwrap()
    }};
    ( $( $t:ty ),+ ) => {{
        let input = readln!();
        let mut input = input.split_whitespace();
        (
            $(
                input.next().unwrap().parse::<$t>().unwrap(),
            )+
        )
    }}
}

fn main() {
    let (result, divider) = readln!(i32, i32);

    let mut min = std::i32::MAX;
    for right in 1..divider {
        if result % right == 0 {
            let x = right + divider * result / right;
            if x < min {
                min = x;
            }
        }
    }

    println!("{}", min);
}

use std::io;

fn main() {
    let mut buffer = String::new();
    io::stdin().read_line(&mut buffer).expect("failed to read input");
    let mut buffer_iter = buffer.split_whitespace().map(|n| n.parse::<u32>().unwrap());
    let n = buffer_iter.next().unwrap();
    let k = buffer_iter.next().unwrap();

    let md = (1..k).rev().find(|x| n % x == 0).unwrap();
    println!("{}", (n / md) * k + md);
}

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let nk: Vec<u32> = s.trim().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    let m = nk[0] * nk[1] + 1;
    for x in 1..m {
        let y = x - x % nk[1];
        if (y / nk[1]) * (x % nk[1]) == nk[0] {
            println!("{}", x);
            break;
        }
    }
}

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let nk: Vec<u32> = s.trim().split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();
    for x in 1..10000001 {
        if (x/nk[1])*(x%nk[1]) == nk[0] {
            println!("{}", x);
            break;
        }
    }
}


use std::io::stdin;
use std::isize;
fn main() {
    let (x,y) = parse_input();
    let abs_x = x.abs();
    let abs_y = y.abs();
    let a =  abs_x+abs_y;
    if abs_x == x && abs_y == y{
        print(0,a ,a,0)
    }else if abs_x != x && abs_y !=y{
        print(-a,0,0,-a)
    }else if abs_x !=x {
        print(-a,0,0,a)
    }else{
        print(0,-a,a,0)
    }
}
fn parse_input()->(isize,isize){
    let mut input = String::new();
    stdin().read_line(&mut input).unwrap();
    let v:Vec<isize> = input.trim().split_whitespace().map(|e| e.parse().unwrap()).collect();
    (v[0],v[1])
}
fn print(a:isize,b:isize,c:isize,d:isize){
    println!("{} {} {} {}",a,b,c,d)
}

struct Scan {
    buffer: std::collections::VecDeque<String>,
}

impl Scan {
    fn new() -> Scan {
        Scan {
            buffer: std::collections::VecDeque::new(),
        }
    }

    fn next_line(&self) -> String {
        let mut line = String::new();
        std::io::stdin().read_line(&mut line).expect("Fail to read");
        line
    }

    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop_front() {
                break token.parse::<T>().ok().unwrap();
            }
            let line = self.next_line();
            self.buffer = line.split_whitespace().map(String::from).collect();
        }
    }
}

fn _main() {
    let mut scan = Scan::new();
    let x: isize = scan.next();
    let y: isize = scan.next();
    let val = x.abs() + y.abs();
    let first = (0, val * y.signum());
    let second = (val * x.signum(), 0);
    let min = first.min(second);
    let max = first.max(second);
    println!("{} {} {} {}", min.0, min.1, max.0, max.1);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(1 << 23)
        .spawn(_main)
        .unwrap()
        .join()
        .unwrap();
}

use std::io::stdin;
use std::isize;
fn main() {
    let (x,y) = parse_input();
    let abs_x = x.abs();
    let abs_y = y.abs();
    let a =  abs_x+abs_y;
    if abs_x == x && abs_y == y{
        print(0,a ,a,0)
    }else if abs_x != x && abs_y !=y{
        print(-a,0,0,a)
    }else if abs_x !=x {
        print(-a,0,0,a)
    }else{
        print(0,-a,a,0)
    }
}
fn parse_input()->(isize,isize){
    let mut input = String::new();
    stdin().read_line(&mut input).unwrap();
    let v:Vec<isize> = input.trim().split_whitespace().map(|e| e.parse().unwrap()).collect();
    (v[0],v[1])
}
fn print(a:isize,b:isize,c:isize,d:isize){
    println!("{} {} {} {}",a,b,c,d)
}

use std::io::stdin;
fn main() {
    let (x,y) = parse_input();
    let abs_x = x.abs();
    let abs_y = y.abs();
    let a =  abs_x+abs_y;
    if abs_x == x && abs_y == y{
        println!("{} {} {} {}",0,a ,a,0)
    }else if abs_x != x && abs_y !=y{
        println!("{} {} {} {}",-a,0,0,a)
    }else if abs_x !=x {
        println!("{} {} {} {}",-a,0,0,a)
    }else{
        println!("{} {} {} {}",0,-a,a,0)
    }
}
fn parse_input()->(isize,isize){
    let mut input = String::new();
    stdin().read_line(&mut input).unwrap();
    let v:Vec<isize> = input.trim().split_whitespace().map(|e| e.parse().unwrap()).collect();
    (v[0],v[1])
}


use std::io;

fn get_line() -> String {
	let mut input = String::new();

	io::stdin().read_line(&mut input)
		.expect("");

	String::from(input.trim())
}

fn main() {
	let s = get_line();
	let t = get_line();

	let mut l = String::new();
	let mut r = String::new();

	let mut k = 0usize;
	for (i, c) in s.chars().enumerate() {
		if c == '|' {
			k = i;
			break;
		}
	}

	for (i, c) in s.chars().enumerate() {
		if i == k {
			break;
		}
		l.push(c);
	}

	for (i, c) in s.chars().enumerate() {
		if i <= k {
			continue;
		}
		r.push(c);
	}

	for c in t.chars() {
		if l.len() < r.len() {
			l.push(c);
		} else {
			r.push(c);
		}
	}

	if l.len() != r.len() {
		println!("Impossible");
	} else {
		println!("{}|{}", l, r);
	}
}

//! http://codeforces.com/contest/382/problem/A

#[macro_export]
macro_rules! scanln {
  ($($var:ident : $ty:path),+) => {
    $(let $var: $ty;)+
    {
      use std::io;
      let mut __buf = String::new();
      io::stdin().read_line(&mut __buf).unwrap();
      let mut eles = __buf.split_whitespace();
      $($var = Scan::scan(&mut eles);)+
    }
  }
}

pub trait Scan {
  fn scan<'a, I>(eles: &mut I) -> Self where I: Iterator<Item=&'a str>;
}

macro_rules! impl_scan_single {
  ($ty:ty) => {
    impl Scan for $ty {
      fn scan<'a, I>(eles: &mut I) -> Self where I: Iterator<Item=&'a str> {
        let next = eles.next().unwrap();
        match next.parse() {
          Ok(res) => res,
          Err(_) => panic!()
        }
      }
    }
  }
}

impl_scan_single!(u8);
impl_scan_single!(u16);
impl_scan_single!(u32);
impl_scan_single!(u64);
impl_scan_single!(usize);
impl_scan_single!(i8);
impl_scan_single!(i16);
impl_scan_single!(i32);
impl_scan_single!(i64);
impl_scan_single!(f32);
impl_scan_single!(f64);
impl_scan_single!(isize);
impl_scan_single!(String);

const __IMPL_SCAN_FOR_VEC: () = {
  use std::str::FromStr;
  impl<T> Scan for Vec<T> where T: FromStr {
    fn scan<'a, I>(eles: &mut I) -> Self where I: Iterator<Item=&'a str> {
      eles.map(|str| match str.parse() {
        Ok(res) => res,
        Err(_) => panic!()
      }).collect()
    }
  }
};

// -----------------------------------------------------------------------------

fn main() {
  scanln!(scale: String);
  scanln!(weights: String);
  let mut pans = scale.split('|');
  let pan1 = pans.next().unwrap();
  let pan2 = pans.next().unwrap();
  let diff = std::cmp::max(pan1.len(), pan2.len()) - std::cmp::min(pan1.len(), pan2.len());
  let common = weights.len() as i32 - diff as i32;
  if common >= 0 && common % 2 == 0 {
    let (less, more) = weights.as_bytes().split_at((weights.len() - diff) / 2);
    let (front, back) = if pan1.len() > pan2.len() { (less, more) } else { (more, less) };
    for c in front.iter().map(|&b| b as char).chain(pan1.chars()) {
      print!("{}", c);
    }
    print!("|");
    for c in back.iter().map(|&b| b as char).chain(pan2.chars()) {
      print!("{}", c);
    }
    println!("");
  } else {
    println!("Impossible");
  }
}

use std::io;

fn get_line() -> String {
	let mut input = String::new();

	io::stdin().read_line(&mut input)
		.expect("");

	String::from(input.trim())
}

fn main() {
	let s = get_line();
	let t = get_line();

	let mut k = 0usize;
	for (i, c) in s.chars().enumerate() {
		if c == '|' {
			k = i;
			break;
		}
	}

	let mut l = String::new();
	for (i, c) in s.chars().enumerate() {
		if i == k {
			break;
		}

		l.push(c);
	}

	let mut r = String::new();
	for (j, d) in s.chars().enumerate() {
		if j <= k {
			continue;
		}

		r.push(d);
	}

	if (t.len() + l.len() + r.len())%2 != 0 {
		println!("Impossible");
		return;
	}

	if l.len() == 0 {
		l.push_str(&t);
	} else if r.len() == 0 {
		r.push_str(&t);
	} else {
		let mut f = if l.len() < r.len() { true } else { false };
    	for c in t.chars() {
			if f {
				l.push(c);
				f = false;
			} else {
				r.push(c);
				f = true;
			}
		}
	}
	println!("{}|{}", l, r);
}

use std::io;

fn get_line() -> String {
	let mut input = String::new();

	io::stdin().read_line(&mut input)
		.expect("");

	String::from(input.trim())
}

fn main() {
	let s = get_line();
	let t = get_line();

	let mut k = 0usize;
	for (i, c) in s.chars().enumerate() {
		if c == '|' {
			k = i;
			break;
		}
	}

	let mut l = String::new();
	for (i, c) in s.chars().enumerate() {
		if i == k {
			break;
		}

		l.push(c);
	}

	let mut r = String::new();
	for (j, d) in s.chars().enumerate() {
		if j <= k {
			continue;
		}

		r.push(d);
	}

	let d = if l.len() < r.len() { r.len()-r.len() } else { l.len()-r.len() };

	if (t.len() + l.len() + r.len())%2 != 0 || d > t.len() {
		println!("Impossible");
		return;
	}

	if l.len() == 0 {
		l.push_str(&t);
	} else if r.len() == 0 {
		r.push_str(&t);
	} else {
		let mut f = if l.len() < r.len() { true } else { false };
    	for c in t.chars() {
			if f {
				l.push(c);
				f = false;
			} else {
				r.push(c);
				f = true;
			}
		}
	}
	println!("{}|{}", l, r);
}

use std::io;

fn get_line() -> String {
	let mut input = String::new();

	io::stdin().read_line(&mut input)
		.expect("");

	String::from(input.trim())
}

fn main() {
	let s = get_line();
	let t = get_line();

	let mut k = 0usize;
	for (i, c) in s.chars().enumerate() {
		if c == '|' {
			k = i;
			break;
		}
	}

	let mut l = String::new();
	for (i, c) in s.chars().enumerate() {
		if i == k {
			break;
		}

		l.push(c);
	}

	let mut r = String::new();
	for (j, d) in s.chars().enumerate() {
		if j <= k {
			continue;
		}

		r.push(d);
	}

	let d = if l.len() < r.len() { r.len()-s.len() } else { l.len()-r.len() };

	if (t.len() + l.len() + r.len())%2 != 0 || d > t.len() {
		println!("Impossible");
		return;
	}

	if l.len() == 0 {
		l.push_str(&t);
	} else if r.len() == 0 {
		r.push_str(&t);
	} else {
		let mut f = if l.len() < r.len() { true } else { false };
    	for c in t.chars() {
			if f {
				l.push(c);
				f = false;
			} else {
				r.push(c);
				f = true;
			}
		}
	}
	println!("{}|{}", l, r);
}

use std::io;

fn get_line() -> String {
	let mut input = String::new();

	io::stdin().read_line(&mut input)
		.expect("");

	String::from(input.trim())
}

fn main() {
	let s = get_line();
	let t = get_line();

	let mut k = 0usize;
	for (i, c) in s.chars().enumerate() {
		if c == '|' {
			k = i;
			break;
		}
	}

	let mut l = String::new();
	for (i, c) in s.chars().enumerate() {
		if i == k {
			break;
		}

		l.push(c);
	}

	let mut r = String::new();
	for (j, d) in s.chars().enumerate() {
		if j <= k {
			continue;
		}

		r.push(d);
	}

	let d = if l.len() < r.len() { r.len()-l.len() } else { l.len()-r.len() };

	if d == 0 {
	 	if t.len()%2 == 0 {
	 		let mut f = true;
	 		for c in t.chars() {
	 			if f {
	 				l.push(c);
	 				f = false;
				} else {
					r.push(c);
					f = true;
				}
			}
			println!("{}|{}", l, r);
	 	} else {
	 		println!("Impossible");
		}
	} else {
		if d != t.len() {
			println!("Impossible");
		} else {
			if l.len() < r.len() {
				for c in t.chars() {
					l.push(c);
				}
			} else {
				for c in t.chars() {
					r.push(c);
				}
			}

			println!("{}|{}", l, r);
		}
	}
}


//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: i64,
        p: i64,
        w: i64,
        d: i64,
    }
    for r in 0..d {
        if p - w * r < 0 || (p - w * r) % d != 0 {
            continue;
        }
        let q = (p - w * r) / (w * d);
        let x = d * q + r;
        let y = (p - w * r) / d - w * q;
        if x + y <= n {
            assert!(x * w + y * d == p);
            let z = n - x - y;
            println!("{} {} {}", x, y, z);
            return;
        }
    }
    println!("-1");
}

fn main() {
    run();
}

use std::io::stdin;

macro_rules! readln {
    ($type:ty) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace().next().unwrap().parse::<$type>().unwrap() }};
    (|$type_vec:ty|) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace().map(|it| it.parse::<$type_vec>().unwrap()).collect::<Vec<$type_vec>>() }};
    ($($type:ty),*) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace(); ($(iter.next().unwrap().parse::<$type>().unwrap(),)*) }};
    ($($type:ty),* |$type_vec:ty|) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        ($(iter.next().unwrap().parse::<$type>().unwrap(),)*iter.map(|it| it.parse::<$type_vec>().unwrap()).collect::<Vec<$type_vec>>(),)}}
}

fn gcd(mut a: u64, mut b: u64) -> u64 {
    while b != 0 {
        a %= b;
        let c = a;
        a = b;
        b = c;
    }
    return a;
}

fn main() {
    let (n, p, w, d) = readln!(u64, u64, u64, u64);

    let gcd = gcd(w, d);
    let lcm = w * d / gcd;
    let x_count = lcm / w;
    let y_count = lcm / d;

    if p % gcd != 0 {
        println!("-1");
        return;
    }

    let mut max_x = if p / w < n { p / w } else { n };
    while max_x != 0 && (p - max_x * w) % d != 0 {
        max_x -= 1;
    }
    let y = (p - max_x * w) / d;

    if max_x + y > n || max_x * w + y * d < p {
        println!("-1")
    } else {
        println!("{} {} {}", max_x, y, n - max_x - y);
    }
}

macro_rules! parse_line {
    ($t: ty) => ({
        let mut a_str = String::new();
        std::io::stdin().read_line(&mut a_str).expect("read error");
        let a_str = a_str.trim();
        a_str.parse::<$t>().expect("parse error")
    });
    ($($t: ty),+) => ({
        let mut a_str = String::new();
        std::io::stdin().read_line(&mut a_str).expect("read error");
        let mut a_iter = a_str.split_whitespace();
        (
            $(
            a_iter.next().unwrap().parse::<$t>().expect("parse error"),
            )+
        )
    })
}

#[allow(unused_macros)]
macro_rules! parse_line_to_vec {
    ($t: ty) => {{
        let mut a_str = String::new();
        std::io::stdin().read_line(&mut a_str).expect("read error");
        (a_str
            .split_whitespace()
            .map(|x| x.parse::<$t>().unwrap())
            .collect::<Vec<$t>>())
    }};
}

use std::io::Write;

fn ext_euclid(a: i128, b: i128, x: &mut i128, y: &mut i128) -> i128 {
    if a == 0 {
        *x = 0;
        *y = 1;
        return b;
    }
    let mut x1 = 0;
    let mut y1 = 0;
    let g = ext_euclid(b % a, a, &mut x1, &mut y1);
    *x = y1 - b / a * x1;
    *y = x1;
    return g;
}

fn solve(writer: &mut std::io::BufWriter<std::io::Stdout>) {
    let (n, p, w, d) = parse_line!(i128, i128, i128, i128);
    let mut x = 0;
    let mut y = 0;
    let g = ext_euclid(w, d, &mut x, &mut y);
    if p % g != 0 {
        writeln!(writer, "-1").unwrap();
        return;
    }
    x *= p / g;
    y *= p / g;
    let step_x = d / g;
    let step_y = w / g;
    if x < 0 {
        let k = (-x + step_x - 1) / step_x;
        x += k * step_x;
        y -= k * step_y;
    }
    if y < 0 {
        let k = (-y + step_y - 1) / step_y;
        x -= k * step_x;
        y += k * step_y;
    }
    if x < 0 {
        writeln!(writer, "-1").unwrap();
        return;
    }
    let k = x / step_x;
    x -= k * step_x;
    y += k * step_y;
    if x + y <= n {
        writeln!(writer, "{} {} {}", x, y, n - x - y).unwrap();
        return;
    }
    let k = y / step_y;
    x += k * step_x;
    y -= k * step_y;
    if x + y <= n {
        writeln!(writer, "{} {} {}", x, y, n - x - y).unwrap();
        return;
    }
    writeln!(writer, "-1").unwrap();
}

fn main() {
    let mut writer = std::io::BufWriter::new(std::io::stdout());
    let tests = 1; // parse_line!(usize);
    for _ in 0..tests {
        solve(&mut writer);
    }
}

//spnauti-rusT {{{
use std::io::*; use std::str::{self,*}; use std::fmt::Debug;
#[allow(unused_imports)] use std::cmp::Ordering::{self,*};
#[allow(unused_imports)] use std::ops::{self,*};
#[allow(unused_imports)] use std::iter::{self,*};
#[allow(unused_imports)] use std::collections::*;
#[allow(unused_imports)] use std::cell::*;
#[allow(unused_macros)] macro_rules! m {
	($c:tt,$x:expr,$y:expr) => {{
		let b=$y; let a=&mut$x; if b$c*a {*a=b; true} else {false}
	}};
}
#[allow(unused_macros)] macro_rules! l {
	($($v:ident),+ =$e:expr) => {$(let$v=$e;)+};
	($($v:ident),+:$t:ty=$e:expr) => {$(let$v:$t=$e;)+};
	(mut $($v:ident),+ =$e:expr) => {$(let mut$v=$e;)+};
	(mut $($v:ident),+:$t:ty=$e:expr) => {$(let mut$v:$t=$e;)+};
}
#[allow(unused_macros)] macro_rules! rep { {[$c:expr]$($s:tt)+} => {for _ in 0..$c {$($s)+}} }
#[allow(dead_code)] fn reader() -> WordReaderC { WordReaderC::new() }
#[allow(dead_code)] fn writer() -> BufWriter<Stdout> { BufWriter::new(stdout()) }
struct WordReaderC {buf: Vec<u8>, pos: usize, q: std::io::StdinLock<'static>}//'
#[allow(dead_code)] impl WordReaderC {
	fn new() -> Self {
		let r = unsafe {&*Box::into_raw(Box::new(stdin()))};
		Self { q: r.lock(), buf: Vec::new(), pos: 0 }
	}
	fn next_line(&mut self) -> bool {
		self.buf.clear(); self.pos = 0;
		self.q.read_until(b'\n', &mut self.buf).unwrap_or(0) > 0
	}
	fn is_ws(c: u8) -> bool {
		c == b' ' || c == b'\r' || c == b'\n' || c == b'\t'
	}
	fn byte(&mut self) -> Option<u8> {
		if self.pos == self.buf.len() { if !self.next_line() { return None; } }
		self.pos += 1; Some(self.buf[self.pos - 1])
	}
	fn vb(&mut self) -> Vec<u8> {
		let mut s = Vec::with_capacity(8);
		let mut f = false;
		loop {
			if let Some(c) = self.byte() {
				if !Self::is_ws(c) {
					s.push(c);
					f = true;
				} else if f { break; }
			} else { break; }
		}
		s
	}
	fn s(&mut self) -> String { String::from_utf8(self.vb()).expect("invalid utf8") }
	fn i(&mut self) ->    i32 { self.p() }
	fn l(&mut self) ->    i64 { self.p() }
	fn u(&mut self) ->  usize { self.p() }
	fn f(&mut self) ->    f64 { self.p() }
	fn vi(&mut self, n: usize) -> Vec<i32> { self.vp(n) }
	fn vl(&mut self, n: usize) -> Vec<i64> { self.vp(n) }
	fn vu(&mut self, n: usize) -> Vec<usize> { self.vp(n) }
	fn ii(&mut self, n: usize) -> impl Iterator<Item=i32> { self.ip(n).into_iter() }
	fn iu(&mut self, n: usize) -> impl Iterator<Item=usize> { self.ip(n).into_iter() }
	fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
		let w = self.vb(); str::from_utf8(w.as_ref()).unwrap().parse::<T>().unwrap()
	}
	fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
		(0..n).map(|_|self.p()).collect()
	}
	fn ip<T: FromStr>(&mut self, n: usize) -> impl Iterator<Item=T> where T::Err: Debug {
		self.vp(n).into_iter()
	}
}
//------------------- End rusT }}}

// Extended Euclidean GCD {{{
fn extended_euclid(a: i64, b: i64) -> (i64,i64,i64) {
	if b == 0 {
		(a,1,0)
	} else {
		let q = div_floor(a,b);
		let r = a - q*b;
		let (d,x,y) = extended_euclid(b, r);
		(d, y, x-q*y)
	}
}//}}}
fn div_floor(a: i64, b: i64) -> i64 {
	assert!(b != 0);
	let (a,b) = if b < 0 {(-a,-b)} else {(a,b)};
	if a % b == 0 || a >= 0 {
		a / b
	} else {
		a / b - 1
	}
}
fn div_ceil(a: i64, b: i64) -> i64 {
	assert!(b != 0);
	let (a,b) = if b < 0 {(-a,-b)} else {(a,b)};
	if a % b == 0 || a <= 0 {
		a / b
	} else {
		a / b + 1
	}
}

fn main() {
	let mut rin = reader();
	let mut rout = writer();

	l!(n,p,a,b = rin.l());
	let (g,x0,y0) = extended_euclid(a,b);
	if p % g == 0 {
		l!(mut x,y = 0);
		let mut e = p / g;
		let mut ee = Vec::new();
		while e > 0 {
			ee.push(e % 10);
			e /= 10;
		}
		ee.reverse();
		for e in ee {
			// writeln!(rout, "g {}  x0 {}  y0 {}   : e {}", g, x0, y0, e).ok();
			x = x * 10 + x0 * e;
			y = y * 10 + y0 * e;
			let ca = -b / g;
			let cb = a / g;
			let kx0 = div_ceil(n - x, ca);
			let kx1 = div_floor(-x, ca);
			let ky0 = div_ceil(-y, cb);
			let ky1 = div_floor(n - y, cb);
			let k0 = kx0.max(ky0);
			let k1 = kx1.min(ky1);
			if k0 <= k1 {
				x += k0 * ca;
				y += k0 * cb;
			}
		}
		if x.min(y) >= 0 && x + y <= n {
			writeln!(rout, "{} {} {}", x, y, n - x - y).ok();
			return;
		}
	}
	writeln!(rout, "-1").ok();
}

//spnauti-rusT {{{
use std::io::*; use std::str::{self,*}; use std::fmt::Debug;
#[allow(unused_imports)] use std::cmp::Ordering::{self,*};
#[allow(unused_imports)] use std::ops::{self,*};
#[allow(unused_imports)] use std::iter::{self,*};
#[allow(unused_imports)] use std::collections::*;
#[allow(unused_imports)] use std::cell::*;
#[allow(unused_macros)] macro_rules! m {
	($c:tt,$x:expr,$y:expr) => {{
		let b=$y; let a=&mut$x; if b$c*a {*a=b; true} else {false}
	}};
}
#[allow(unused_macros)] macro_rules! l {
	($($v:ident),+ =$e:expr) => {$(let$v=$e;)+};
	($($v:ident),+:$t:ty=$e:expr) => {$(let$v:$t=$e;)+};
	(mut $($v:ident),+ =$e:expr) => {$(let mut$v=$e;)+};
	(mut $($v:ident),+:$t:ty=$e:expr) => {$(let mut$v:$t=$e;)+};
}
#[allow(unused_macros)] macro_rules! rep { {[$c:expr]$($s:tt)+} => {for _ in 0..$c {$($s)+}} }
#[allow(dead_code)] fn reader() -> WordReaderC { WordReaderC::new() }
#[allow(dead_code)] fn writer() -> BufWriter<Stdout> { BufWriter::new(stdout()) }
struct WordReaderC {buf: Vec<u8>, pos: usize, q: std::io::StdinLock<'static>}//'
#[allow(dead_code)] impl WordReaderC {
	fn new() -> Self {
		let r = unsafe {&*Box::into_raw(Box::new(stdin()))};
		Self { q: r.lock(), buf: Vec::new(), pos: 0 }
	}
	fn next_line(&mut self) -> bool {
		self.buf.clear(); self.pos = 0;
		self.q.read_until(b'\n', &mut self.buf).unwrap_or(0) > 0
	}
	fn is_ws(c: u8) -> bool {
		c == b' ' || c == b'\r' || c == b'\n' || c == b'\t'
	}
	fn byte(&mut self) -> Option<u8> {
		if self.pos == self.buf.len() { if !self.next_line() { return None; } }
		self.pos += 1; Some(self.buf[self.pos - 1])
	}
	fn vb(&mut self) -> Vec<u8> {
		let mut s = Vec::with_capacity(8);
		let mut f = false;
		loop {
			if let Some(c) = self.byte() {
				if !Self::is_ws(c) {
					s.push(c);
					f = true;
				} else if f { break; }
			} else { break; }
		}
		s
	}
	fn s(&mut self) -> String { String::from_utf8(self.vb()).expect("invalid utf8") }
	fn i(&mut self) ->    i32 { self.p() }
	fn l(&mut self) ->    i64 { self.p() }
	fn u(&mut self) ->  usize { self.p() }
	fn f(&mut self) ->    f64 { self.p() }
	fn vi(&mut self, n: usize) -> Vec<i32> { self.vp(n) }
	fn vl(&mut self, n: usize) -> Vec<i64> { self.vp(n) }
	fn vu(&mut self, n: usize) -> Vec<usize> { self.vp(n) }
	fn ii(&mut self, n: usize) -> impl Iterator<Item=i32> { self.ip(n).into_iter() }
	fn iu(&mut self, n: usize) -> impl Iterator<Item=usize> { self.ip(n).into_iter() }
	fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
		let w = self.vb(); str::from_utf8(w.as_ref()).unwrap().parse::<T>().unwrap()
	}
	fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
		(0..n).map(|_|self.p()).collect()
	}
	fn ip<T: FromStr>(&mut self, n: usize) -> impl Iterator<Item=T> where T::Err: Debug {
		self.vp(n).into_iter()
	}
}
//------------------- End rusT }}}

fn main() {
	let mut rin = reader();
	let mut rout = writer();

	l!(n,p,a,b = rin.l());
	for y in 0..a {
		if (p - b*y) % a == 0 {
			let x = (p - b*y) / a;
			if x >= 0 && x + y <= n {
				writeln!(rout, "{} {} {}", x, y, n - x - y).ok();
				return;
			}
		}
	}
	writeln!(rout, "-1").ok();
}

mod io {
    use std::io::{self, BufRead};
    use std::str::{self, FromStr, SplitAsciiWhitespace};
    use super::Result;

    pub struct Scanner<'a, R> {
        reader: R,
        buf_str: Vec<u8>,
        buf_iter: SplitAsciiWhitespace<'a>,
    }

    impl<R: BufRead> Scanner<'_, R> {
        pub fn new(reader: R) -> Self {
            Self {
                reader,
                buf_str: Vec::new(),
                buf_iter: "".split_ascii_whitespace(),
            }
        }

        pub fn token<T>(&mut self) -> Result<T>
            where T: FromStr,
                  <T as FromStr>::Err: 'static + std::error::Error
        {
            loop {
                if let Some(token) = self.buf_iter.next() {
                    return Ok(token.parse()?);
                }
                self.buf_str.clear();
                let bytes_read = self.reader
                    .read_until(b'\n', &mut self.buf_str)?;
                if bytes_read == 0 {
                    return Err(Box::new(io::Error::from(io::ErrorKind::UnexpectedEof)));
                }
                self.buf_iter = unsafe {
                    let slice = str::from_utf8_unchecked(&self.buf_str);
                    ::std::mem::transmute(slice.split_ascii_whitespace())
                }
            }
        }
    }
}

use std::io::{stdin, stdout, BufRead, Write};
use io::Scanner;

pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;

fn main() -> Result<()> {
    let stdin = stdin();
    solve(Scanner::new(stdin.lock()), stdout().lock())
}

fn solve<R: BufRead, W: Write>(mut scan: Scanner<R>, mut out: W) -> Result<()> {
    let (n, mut p, mut w, mut d) =
        (scan.token::<i64>()?, scan.token::<i64>()?, scan.token::<i64>()?, scan.token::<i64>()?);
    let (g, ..) = ext_euclid(w, d);
    if p % g != 0 {
        writeln!(out, "-1")?;
        return Ok(());
    }
    p /= g;
    w /= g;
    d /= g;
    let y = p % w * inv(d, w) % w;
    let x = (p - d * y) / w;
    if x < 0 || x + y > n {
        writeln!(out, "-1")?;
        return Ok(());
    }
    let z = n - x - y;
    writeln!(out, "{} {} {}", x, y, z)?;
    Ok(())
}

pub fn ext_euclid(a: i64, b: i64) -> (i64, i64, i64) {
    if b == 0 {
        (a, 1, 0)
    } else {
        let (d, x, y) = ext_euclid(b, a % b);
        (d, y, x - a / b * y)
    }
}

fn inv(a: i64, n: i64) -> i64 {
    let (_, x, ..) = ext_euclid(a, n);
    (n + x) % n
}

#[cfg(test)]
mod tests {
    use super::*;

    macro_rules! t {
        ( $inp:expr, $expected:expr ) => {
            let mut out = String::new();
            solve(Scanner::new($inp.as_bytes()), unsafe { out.as_mut_vec() }).unwrap();
            assert_eq!(out, $expected);
        };
    }

    #[test]
    fn example1() {
        //t!("30 60 3 1\n", "17 9 4\n");
        t!("30 60 3 1\n", "20 0 10\n");
    }

    #[test]
    fn example2() {
        t!("10 51 5 4\n", "-1\n");
    }

    #[test]
    fn example3() {
        t!("20 0 15 5\n", "0 0 20\n");
    }

    #[test]
    fn t() {
        t!("4 7 3 2\n", "1 2 1\n");
        t!("1000000000000 99999999999999999 100000 99999\n", "999999999999 1 0\n");
        t!("923399641127 50915825165227299 94713 49302\n", "537580105939 11996 385819523192\n");
    }
}

//spnauti-rusT {{{
use std::io::*; use std::str::{self,*}; use std::fmt::Debug;
#[allow(unused_imports)] use std::cmp::Ordering::{self,*};
#[allow(unused_imports)] use std::ops::{self,*};
#[allow(unused_imports)] use std::iter::{self,*};
#[allow(unused_imports)] use std::collections::*;
#[allow(unused_imports)] use std::cell::*;
#[allow(unused_macros)] macro_rules! m {
	($c:tt,$x:expr,$y:expr) => {{
		let b=$y; let a=&mut$x; if b$c*a {*a=b; true} else {false}
	}};
}
#[allow(unused_macros)] macro_rules! l {
	($($v:ident),+ =$e:expr) => {$(let$v=$e;)+};
	($($v:ident),+:$t:ty=$e:expr) => {$(let$v:$t=$e;)+};
	(mut $($v:ident),+ =$e:expr) => {$(let mut$v=$e;)+};
	(mut $($v:ident),+:$t:ty=$e:expr) => {$(let mut$v:$t=$e;)+};
}
#[allow(unused_macros)] macro_rules! rep { {[$c:expr]$($s:tt)+} => {for _ in 0..$c {$($s)+}} }
#[allow(dead_code)] fn reader() -> WordReaderC { WordReaderC::new() }
#[allow(dead_code)] fn writer() -> BufWriter<Stdout> { BufWriter::new(stdout()) }
struct WordReaderC {buf: Vec<u8>, pos: usize, q: std::io::StdinLock<'static>}//'
#[allow(dead_code)] impl WordReaderC {
	fn new() -> Self {
		let r = unsafe {&*Box::into_raw(Box::new(stdin()))};
		Self { q: r.lock(), buf: Vec::new(), pos: 0 }
	}
	fn next_line(&mut self) -> bool {
		self.buf.clear(); self.pos = 0;
		self.q.read_until(b'\n', &mut self.buf).unwrap_or(0) > 0
	}
	fn is_ws(c: u8) -> bool {
		c == b' ' || c == b'\r' || c == b'\n' || c == b'\t'
	}
	fn byte(&mut self) -> Option<u8> {
		if self.pos == self.buf.len() { if !self.next_line() { return None; } }
		self.pos += 1; Some(self.buf[self.pos - 1])
	}
	fn vb(&mut self) -> Vec<u8> {
		let mut s = Vec::with_capacity(8);
		let mut f = false;
		loop {
			if let Some(c) = self.byte() {
				if !Self::is_ws(c) {
					s.push(c);
					f = true;
				} else if f { break; }
			} else { break; }
		}
		s
	}
	fn s(&mut self) -> String { String::from_utf8(self.vb()).expect("invalid utf8") }
	fn i(&mut self) ->    i32 { self.p() }
	fn l(&mut self) ->    i64 { self.p() }
	fn u(&mut self) ->  usize { self.p() }
	fn f(&mut self) ->    f64 { self.p() }
	fn vi(&mut self, n: usize) -> Vec<i32> { self.vp(n) }
	fn vl(&mut self, n: usize) -> Vec<i64> { self.vp(n) }
	fn vu(&mut self, n: usize) -> Vec<usize> { self.vp(n) }
	fn ii(&mut self, n: usize) -> impl Iterator<Item=i32> { self.ip(n).into_iter() }
	fn iu(&mut self, n: usize) -> impl Iterator<Item=usize> { self.ip(n).into_iter() }
	fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
		let w = self.vb(); str::from_utf8(w.as_ref()).unwrap().parse::<T>().unwrap()
	}
	fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
		(0..n).map(|_|self.p()).collect()
	}
	fn ip<T: FromStr>(&mut self, n: usize) -> impl Iterator<Item=T> where T::Err: Debug {
		self.vp(n).into_iter()
	}
}
//------------------- End rusT }}}

// Extended Euclidean GCD {{{
fn extended_euclid(a: i64, b: i64) -> (i64,i64,i64) {
	if b == 0 {
		(a,1,0)
	} else {
		let q = div_floor(a,b);
		let r = a - q*b;
		let (d,x,y) = extended_euclid(b, r);
		(d, y, x-q*y)
	}
}//}}}
fn div_floor(a: i64, b: i64) -> i64 {
	assert!(b != 0);
	let (a,b) = if b < 0 {(-a,-b)} else {(a,b)};
	if a % b == 0 || a >= 0 {
		a / b
	} else {
		a / b - 1
	}
}
fn div_ceil(a: i64, b: i64) -> i64 {
	assert!(b != 0);
	let (a,b) = if b < 0 {(-a,-b)} else {(a,b)};
	if a % b == 0 || a <= 0 {
		a / b
	} else {
		a / b + 1
	}
}

fn main() {
	let mut rin = reader();
	let mut rout = writer();

	l!(n,p,a,b = rin.l());
	let (g,x0,y0) = extended_euclid(a,b);
	if p % g == 0 {
		l!(mut x,y = 0);
		let mut e = p / g;
		let mut ee = Vec::new();
		while e > 0 {
			ee.push(e % 10);
			e /= 10;
		}
		ee.reverse();
		for e in ee {
			// writeln!(rout, "g {}  x0 {}  y0 {}   : e {}", g, x0, y0, e).ok();
			x = x * 10 + x0 * e;
			y = y * 10 + y0 * e;
			let ca = -b / g;
			let cb = a / g;
			let kx0 = div_ceil(n - x, ca);
			let kx1 = div_floor(-x, ca);
			let ky0 = div_ceil(-y, cb);
			let ky1 = div_floor(n - y, cb);
			let k0 = kx0.max(ky0);
			let k1 = kx1.min(ky1);
			if k0 <= k1 {
				x += k0 * ca;
				y += k0 * cb;
			}
		}
		if x + y <= n {
			writeln!(rout, "{} {} {}", x, y, n - x - y).ok();
			return;
		}
	}
	writeln!(rout, "-1").ok();
}

//spnauti-rusT {{{
use std::io::*; use std::str::{self,*}; use std::fmt::Debug;
#[allow(unused_imports)] use std::cmp::Ordering::{self,*};
#[allow(unused_imports)] use std::ops::{self,*};
#[allow(unused_imports)] use std::iter::{self,*};
#[allow(unused_imports)] use std::collections::*;
#[allow(unused_imports)] use std::cell::*;
#[allow(unused_macros)] macro_rules! m {
	($c:tt,$x:expr,$y:expr) => {{
		let b=$y; let a=&mut$x; if b$c*a {*a=b; true} else {false}
	}};
}
#[allow(unused_macros)] macro_rules! l {
	($($v:ident),+ =$e:expr) => {$(let$v=$e;)+};
	($($v:ident),+:$t:ty=$e:expr) => {$(let$v:$t=$e;)+};
	(mut $($v:ident),+ =$e:expr) => {$(let mut$v=$e;)+};
	(mut $($v:ident),+:$t:ty=$e:expr) => {$(let mut$v:$t=$e;)+};
}
#[allow(unused_macros)] macro_rules! rep { {[$c:expr]$($s:tt)+} => {for _ in 0..$c {$($s)+}} }
#[allow(dead_code)] fn reader() -> WordReaderC { WordReaderC::new() }
#[allow(dead_code)] fn writer() -> BufWriter<Stdout> { BufWriter::new(stdout()) }
struct WordReaderC {buf: Vec<u8>, pos: usize, q: std::io::StdinLock<'static>}//'
#[allow(dead_code)] impl WordReaderC {
	fn new() -> Self {
		let r = unsafe {&*Box::into_raw(Box::new(stdin()))};
		Self { q: r.lock(), buf: Vec::new(), pos: 0 }
	}
	fn next_line(&mut self) -> bool {
		self.buf.clear(); self.pos = 0;
		self.q.read_until(b'\n', &mut self.buf).unwrap_or(0) > 0
	}
	fn is_ws(c: u8) -> bool {
		c == b' ' || c == b'\r' || c == b'\n' || c == b'\t'
	}
	fn byte(&mut self) -> Option<u8> {
		if self.pos == self.buf.len() { if !self.next_line() { return None; } }
		self.pos += 1; Some(self.buf[self.pos - 1])
	}
	fn vb(&mut self) -> Vec<u8> {
		let mut s = Vec::with_capacity(8);
		let mut f = false;
		loop {
			if let Some(c) = self.byte() {
				if !Self::is_ws(c) {
					s.push(c);
					f = true;
				} else if f { break; }
			} else { break; }
		}
		s
	}
	fn s(&mut self) -> String { String::from_utf8(self.vb()).expect("invalid utf8") }
	fn i(&mut self) ->    i32 { self.p() }
	fn l(&mut self) ->    i64 { self.p() }
	fn u(&mut self) ->  usize { self.p() }
	fn f(&mut self) ->    f64 { self.p() }
	fn vi(&mut self, n: usize) -> Vec<i32> { self.vp(n) }
	fn vl(&mut self, n: usize) -> Vec<i64> { self.vp(n) }
	fn vu(&mut self, n: usize) -> Vec<usize> { self.vp(n) }
	fn ii(&mut self, n: usize) -> impl Iterator<Item=i32> { self.ip(n).into_iter() }
	fn iu(&mut self, n: usize) -> impl Iterator<Item=usize> { self.ip(n).into_iter() }
	fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
		let w = self.vb(); str::from_utf8(w.as_ref()).unwrap().parse::<T>().unwrap()
	}
	fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
		(0..n).map(|_|self.p()).collect()
	}
	fn ip<T: FromStr>(&mut self, n: usize) -> impl Iterator<Item=T> where T::Err: Debug {
		self.vp(n).into_iter()
	}
}
//------------------- End rusT }}}

// Extended Euclidean GCD {{{
fn extended_euclid(a: i64, b: i64) -> (i64,i64,i64) {
	if b == 0 {
		(a,1,0)
	} else {
		let q = div_floor(a,b);
		let r = a - q*b;
		let (d,x,y) = extended_euclid(b, r);
		(d, y, x-q*y)
	}
}//}}}
fn div_floor(a: i64, b: i64) -> i64 {
	assert!(b != 0);
	let (a,b) = if b < 0 {(-a,-b)} else {(a,b)};
	if a % b == 0 || a >= 0 {
		a / b
	} else {
		a / b - 1
	}
}
fn div_ceil(a: i64, b: i64) -> i64 {
	assert!(b != 0);
	let (a,b) = if b < 0 {(-a,-b)} else {(a,b)};
	if a % b == 0 || a <= 0 {
		a / b
	} else {
		a / b + 1
	}
}

fn main() {
	let mut rin = reader();
	let mut rout = writer();

	l!(n,p,a,b = rin.l());
	let (g,x0,y0) = extended_euclid(a,b);
	if p % g == 0 {
		let e = p / g;
		let x = x0 * e;
		let y = y0 * e;
		let ca = -b / g;
		let cb = a / g;
		let kx0 = div_ceil(n - x, ca);
		let kx1 = div_floor(-x, ca);
		let ky0 = div_ceil(-y, cb);
		let ky1 = div_floor(n - y, cb);
		let k0 = kx0.max(ky0);
		let k1 = kx1.min(ky1);
		if k0 <= k1 {
			for k in vec![k0,k1] {
				let xx = x + k * ca;
				let yy = y + k * cb;
				if xx + yy <= n {
					writeln!(rout, "{} {} {}", xx, yy, n - xx - yy).ok();
					return;
				}
			}
		}
	}
	writeln!(rout, "-1").ok();
}

mod io {
    use std::io::{self, BufRead};
    use std::str::{self, FromStr, SplitAsciiWhitespace};
    use super::Result;

    pub struct Scanner<'a, R> {
        reader: R,
        buf_str: Vec<u8>,
        buf_iter: SplitAsciiWhitespace<'a>,
    }

    impl<R: BufRead> Scanner<'_, R> {
        pub fn new(reader: R) -> Self {
            Self {
                reader,
                buf_str: Vec::new(),
                buf_iter: "".split_ascii_whitespace(),
            }
        }

        pub fn token<T>(&mut self) -> Result<T>
            where T: FromStr,
                  <T as FromStr>::Err: 'static + std::error::Error
        {
            loop {
                if let Some(token) = self.buf_iter.next() {
                    return Ok(token.parse()?);
                }
                self.buf_str.clear();
                let bytes_read = self.reader
                    .read_until(b'\n', &mut self.buf_str)?;
                if bytes_read == 0 {
                    return Err(Box::new(io::Error::from(io::ErrorKind::UnexpectedEof)));
                }
                self.buf_iter = unsafe {
                    let slice = str::from_utf8_unchecked(&self.buf_str);
                    ::std::mem::transmute(slice.split_ascii_whitespace())
                }
            }
        }
    }
}

use std::io::{stdin, stdout, BufRead, Write};
use io::Scanner;

pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;

fn main() -> Result<()> {
    let stdin = stdin();
    solve(Scanner::new(stdin.lock()), stdout().lock())
}

fn solve<R: BufRead, W: Write>(mut scan: Scanner<R>, mut out: W) -> Result<()> {
    let (n, mut p, mut w, mut d) =
        (scan.token::<u64>()?, scan.token::<u64>()?, scan.token::<u64>()?, scan.token::<u64>()?);
    let g = gcd(w, d);
    p /= g;
    let rem_p = p % g;
    if rem_p != 0 {
        writeln!(out, "-1")?;
        return Ok(());
    }
    w /= g;
    d /= g;
    let y = p * mpow(d, w - 2, w) % w;
    let x = (p - d * y) / w;
    if x + y > n {
        writeln!(out, "-1")?;
        return Ok(());
    }
    let z = n - x - y;
    writeln!(out, "{} {} {}", x, y, z)?;
    Ok(())
}

fn gcd(mut a: u64, mut b: u64) -> u64 {
    while a != b {
        if a > b { a = a - b; } else { b = b - a; }
    }
    a
}

pub fn mpow(mut base: u64, mut exp: u64, m: u64) -> u64 {
    let mut result = 1;
    base %= m;
    while exp > 1 {
        if exp & 1 == 1 {
            result = (result * base) % m;
        }
        exp >>= 1;
        base = (base * base) % m;
    }
    if exp == 1 {
        result = (result * base) % m;
    }
    result
}

#[cfg(test)]
mod tests {
    use super::*;

    macro_rules! t {
        ( $inp:expr, $expected:expr ) => {
            let mut out = String::new();
            solve(Scanner::new($inp.as_bytes()), unsafe { out.as_mut_vec() }).unwrap();
            assert_eq!(out, $expected);
        };
    }

    #[test]
    fn example1() {
        //t!("30 60 3 1\n", "17 9 4\n");
        t!("30 60 3 1\n", "20 0 10\n");
    }

    #[test]
    fn example2() {
        t!("10 51 5 4\n", "-1\n");
    }

    #[test]
    fn example3() {
        t!("20 0 15 5\n", "0 0 20\n");
    }

    #[test]
    fn t() {
        t!("4 7 3 2\n", "1 2 1\n");
    }
}

mod io {
    use std::io::{self, BufRead};
    use std::str::{self, FromStr, SplitAsciiWhitespace};
    use super::Result;

    pub struct Scanner<'a, R> {
        reader: R,
        buf_str: Vec<u8>,
        buf_iter: SplitAsciiWhitespace<'a>,
    }

    impl<R: BufRead> Scanner<'_, R> {
        pub fn new(reader: R) -> Self {
            Self {
                reader,
                buf_str: Vec::new(),
                buf_iter: "".split_ascii_whitespace(),
            }
        }

        pub fn token<T>(&mut self) -> Result<T>
            where T: FromStr,
                  <T as FromStr>::Err: 'static + std::error::Error
        {
            loop {
                if let Some(token) = self.buf_iter.next() {
                    return Ok(token.parse()?);
                }
                self.buf_str.clear();
                let bytes_read = self.reader
                    .read_until(b'\n', &mut self.buf_str)?;
                if bytes_read == 0 {
                    return Err(Box::new(io::Error::from(io::ErrorKind::UnexpectedEof)));
                }
                self.buf_iter = unsafe {
                    let slice = str::from_utf8_unchecked(&self.buf_str);
                    ::std::mem::transmute(slice.split_ascii_whitespace())
                }
            }
        }
    }
}

use std::io::{stdin, stdout, BufRead, Write};
use io::Scanner;

pub type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;

fn main() -> Result<()> {
    let stdin = stdin();
    solve(Scanner::new(stdin.lock()), stdout().lock())
}

fn solve<R: BufRead, W: Write>(mut scan: Scanner<R>, mut out: W) -> Result<()> {
    let (n, mut p, mut w, mut d) =
        (scan.token::<i64>()?, scan.token::<i64>()?, scan.token::<i64>()?, scan.token::<i64>()?);
    let (g, ..) = ext_euclid(w, d);
    p /= g;
    if p % g != 0 {
        writeln!(out, "-1")?;
        return Ok(());
    }
    w /= g;
    d /= g;
    let y = p % w * inv(d, w) % w;
    let x = (p - d * y) / w;
    if x < 0 || x + y > n {
        writeln!(out, "-1")?;
        return Ok(());
    }
    let z = n - x - y;
    writeln!(out, "{} {} {}", x, y, z)?;
    Ok(())
}

pub fn ext_euclid(a: i64, b: i64) -> (i64, i64, i64) {
    if b == 0 {
        (a, 1, 0)
    } else {
        let (d, x, y) = ext_euclid(b, a % b);
        (d, y, x - a / b * y)
    }
}

fn inv(a: i64, n: i64) -> i64 {
    let (_, x, ..) = ext_euclid(a, n);
    (n + x) % n
}

#[cfg(test)]
mod tests {
    use super::*;

    macro_rules! t {
        ( $inp:expr, $expected:expr ) => {
            let mut out = String::new();
            solve(Scanner::new($inp.as_bytes()), unsafe { out.as_mut_vec() }).unwrap();
            assert_eq!(out, $expected);
        };
    }

    #[test]
    fn example1() {
        //t!("30 60 3 1\n", "17 9 4\n");
        t!("30 60 3 1\n", "20 0 10\n");
    }

    #[test]
    fn example2() {
        t!("10 51 5 4\n", "-1\n");
    }

    #[test]
    fn example3() {
        t!("20 0 15 5\n", "0 0 20\n");
    }

    #[test]
    fn t() {
        t!("4 7 3 2\n", "1 2 1\n");
        t!("1000000000000 99999999999999999 100000 99999\n", "999999999999 1 0\n");
    }
}

use std::io::stdin;

macro_rules! readln {
    ($type:ty) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace().next().unwrap().parse::<$type>().unwrap() }};
    (|$type_vec:ty|) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace().map(|it| it.parse::<$type_vec>().unwrap()).collect::<Vec<$type_vec>>() }};
    ($($type:ty),*) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace(); ($(iter.next().unwrap().parse::<$type>().unwrap(),)*) }};
    ($($type:ty),* |$type_vec:ty|) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        ($(iter.next().unwrap().parse::<$type>().unwrap(),)*iter.map(|it| it.parse::<$type_vec>().unwrap()).collect::<Vec<$type_vec>>(),)}}
}

fn gcd(mut a: u64, mut b: u64) -> u64 {
    while b != 0 {
        a %= b;
        let c = a;
        a = b;
        b = c;
    }
    return a;
}

fn main() {
    let (n, p, w, d) = readln!(u64, u64, u64, u64);

    let gcd = gcd(w, d);
    let lcm = w * d / gcd;
    let x_count = lcm / w;
    let y_count = lcm / d;

    if p % gcd != 0 {
        println!("-1");
        return;
    }

    let mut max_x = if p / w < n { p / w } else { n };
    while (p - max_x * w) % d != 0 {
        max_x -= 1;
    }
    let y = (p - max_x * w) / d;

    if max_x + y > n || max_x * w + y * d < p {
        println!("-1")
    } else {
        println!("{} {} {}", max_x, y, n - max_x - y);
    }
}

use std::io::stdin;

macro_rules! readln {
    ($type:ty) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace().next().unwrap().parse::<$type>().unwrap() }};
    (|$type_vec:ty|) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace().map(|it| it.parse::<$type_vec>().unwrap()).collect::<Vec<$type_vec>>() }};
    ($($type:ty),*) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace(); ($(iter.next().unwrap().parse::<$type>().unwrap(),)*) }};
    ($($type:ty),* |$type_vec:ty|) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        ($(iter.next().unwrap().parse::<$type>().unwrap(),)*iter.map(|it| it.parse::<$type_vec>().unwrap()).collect::<Vec<$type_vec>>(),)}}
}

fn gcd(mut a: u64, mut b: u64) -> u64 {
    while b != 0 {
        a %= b;
        let c = a;
        a = b;
        b = c;
    }
    return a;
}

fn main() {
    let (n, p, w, d) = readln!(u64, u64, u64, u64);

    let gcd = gcd(w, d);
    let lcm = w * d / gcd;
    let x_count = lcm / w;
    let y_count = lcm / d;

    let max_x = if p / w < n { p / w } else { n };
    let mut y = (p - max_x * w) / d;
    let max_x = max_x - y * d;

    if max_x + y > n || p % lcm != 0 {
        println!("-1")
    } else {
        for x in (0..=max_x).rev().step_by(x_count as usize) {
            if x * w + y * d != p {
                y += y_count;
            } else {
                println!("{} {} {}", x, y, n - x - y);
                break
            }
        }
    }
}

use std::io::stdin;

macro_rules! readln {
    ($type:ty) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace().next().unwrap().parse::<$type>().unwrap() }};
    (|$type_vec:ty|) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace().map(|it| it.parse::<$type_vec>().unwrap()).collect::<Vec<$type_vec>>() }};
    ($($type:ty),*) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace(); ($(iter.next().unwrap().parse::<$type>().unwrap(),)*) }};
    ($($type:ty),* |$type_vec:ty|) => {{
        let mut line = String::new();
        stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        ($(iter.next().unwrap().parse::<$type>().unwrap(),)*iter.map(|it| it.parse::<$type_vec>().unwrap()).collect::<Vec<$type_vec>>(),)}}
}

fn gcd(mut a: u64, mut b: u64) -> u64 {
    while b != 0 {
        a %= b;
        let c = a;
        a = b;
        b = c;
    }
    return a;
}

fn main() {
    let (n, p, w, d) = readln!(u64, u64, u64, u64);

    let gcd = gcd(w, d);
    let lcm = w * d / gcd;
    let x_count = lcm / w;
    let y_count = lcm / d;

    let max_x = if p / w < n { p / w } else { n };
    let mut y = (p - max_x * w) / d;
    let max_x = max_x - y * d;

    if max_x + y > n || p % gcd != 0 || max_x * w + y * d < p {
        println!("-1")
    } else {
        println!("{} {} {}", max_x, y, n - max_x - y);
    }
}

macro_rules! parse_line {
    ($t: ty) => ({
        let mut a_str = String::new();
        std::io::stdin().read_line(&mut a_str).expect("read error");
        let a_str = a_str.trim();
        a_str.parse::<$t>().expect("parse error")
    });
    ($($t: ty),+) => ({
        let mut a_str = String::new();
        std::io::stdin().read_line(&mut a_str).expect("read error");
        let mut a_iter = a_str.split_whitespace();
        (
            $(
            a_iter.next().unwrap().parse::<$t>().expect("parse error"),
            )+
        )
    })
}

#[allow(unused_macros)]
macro_rules! parse_line_to_vec {
    ($t: ty) => {{
        let mut a_str = String::new();
        std::io::stdin().read_line(&mut a_str).expect("read error");
        (a_str
            .split_whitespace()
            .map(|x| x.parse::<$t>().unwrap())
            .collect::<Vec<$t>>())
    }};
}

use std::io::Write;

fn ext_euclid(a: i64, b: i64, x: &mut i64, y: &mut i64) -> i64 {
    if a == 0 {
        *x = 0;
        *y = 1;
        return b;
    }
    let mut x1 = 0;
    let mut y1 = 0;
    let g = ext_euclid(b % a, a, &mut x1, &mut y1);
    *x = y1 - b / a * x1;
    *y = x1;
    return g;
}

fn solve(writer: &mut std::io::BufWriter<std::io::Stdout>) {
    let (n, p, w, d) = parse_line!(i64, i64, i64, i64);
    let mut x = 0;
    let mut y = 0;
    let g = ext_euclid(w, d, &mut x, &mut y);
    if p % g != 0 {
        writeln!(writer, "-1").unwrap();
        return;
    }
    x *= p / g;
    y *= p / g;
    let step_x = d / g;
    let step_y = w / g;
    if x < 0 {
        let k = (-x + step_x - 1) / step_x;
        x += k * step_x;
        y -= k * step_y;
    }
    if y < 0 {
        let k = (-y + step_y - 1) / step_y;
        x -= k * step_x;
        y += k * step_y;
    }
    if x < 0 {
        writeln!(writer, "-1").unwrap();
        return;
    }
    let k = x / step_x;
    x -= k * step_x;
    y += k * step_y;
    if x + y <= n {
        writeln!(writer, "{} {} {}", x, y, n - x - y).unwrap();
        return;
    }
    let k = y / step_y;
    x += k * step_x;
    y -= k * step_y;
    if x + y <= n {
        writeln!(writer, "{} {} {}", x, y, n - x - y).unwrap();
        return;
    }
    writeln!(writer, "-1").unwrap();
}

fn main() {
    let mut writer = std::io::BufWriter::new(std::io::stdout());
    let tests = 1; // parse_line!(usize);
    for _ in 0..tests {
        solve(&mut writer);
    }
}


#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: i64,
      v: i64,
    }
    if v>=n-1 {
        return println!("{}", n-1);
    }
    let mut ans = 0;
    for i in 1..(n-v+1) {
        if i == 1 {
            ans += v;
        } else {
            ans += i;
        }
    }
    println!("{}", ans);
}

use std::io::{stdin, stdout, BufWriter, Write};

#[derive(Default)]
struct Scanner {
    buffer: Vec<String>,
}
impl Scanner {
    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn main() {
    let mut scan = Scanner::default();

    let info: Vec<i32> = (0..2).map(|_| scan.next()).collect();
    let mut cost = 0;
    let mut tank = 0;

    if info[0] - 1 <= info[1] {
        println!("{}", info[0] - 1);
        return;
    }

    for i in 0..info[0] - 1 {
        if tank < (info[0] - 1 - i) {
            cost += (info[1] - tank) * (i + 1);
            tank = info[1];
        }
        tank -= 1;
    }

    println!("{}", cost);
}

/*input
97 99
*/
fn main() {
    let mut input = format!("");
    std::io::stdin().read_line(&mut input).ok();
    let v: Vec<i16> = input
        .trim()
        .split_whitespace()
        .map(|x| x.parse().expect(""))
        .collect();
    if v[0] - 1 <= v[1] {
        println!("{}", v[0] - 1);
        std::process::exit(0);
    }
    let mut money_to_spent = v[1];
    let mut fuel = v[1];
    for i in 1..v[0] {
        if i != 1 {
            fuel = fuel - 1;
        }
        //println!("CITY: {} F: {} SISA: {}", i, fuel, v[0] - i);
        // 1 2 3 4 5 6 7 8 9
        //   2
        if v[0] - i <= fuel {
            break;
        }
        if i != 1 {
            money_to_spent = money_to_spent + i;
            fuel = fuel + 1;
        }
    }
    println!("{}", money_to_spent);
}

#[warn(unused_variables)]
fn main() {
    let input = input_vec::<u64>(" ");
    let n = input[0];
    let v = input[1];

    println!("{}", if (n-1) <= v {n-1} else {(n-v+1)*(n-v)/2 + v-1})
}

fn input_str() -> String {
    let mut buff = String::new();
    std::io::stdin().read_line(&mut buff).expect("Err");
    buff
}

fn input_<T>() -> T
where
    T: std::str::FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    input_str().trim().parse::<T>().expect("Err pars")
}

fn input_vec<T>(sep: &str) -> Vec<T>
where
    T: std::str::FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    input_str().trim().split(sep).map(|c| c.parse::<T>().expect("Err pars")).collect()
}

fn input_vec_chars() -> Vec<char> {
    input_str().trim().chars().collect()
}

use std::io::{stdin, stdout, BufWriter, Write};

#[derive(Default)]
struct Scanner {
    buffer: Vec<String>,
}
impl Scanner {
    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn main() {
    let mut scan = Scanner::default();

    let info: Vec<i32> = (0..2).map(|_| scan.next()).collect();
    let mut cost = 0;
    let mut tank = 0;

    for i in 0..info[0] - 1 {
        if tank < (info[0] - 1 - i) {
            cost += (info[1] - tank) * (i + 1);
            tank = info[1];
        }
        tank -= 1;
    }

    println!("{}", cost);
}