The football season has just ended in Berland. According to the rules of Berland football, each match is played between two teams. The result of each match is either a draw, or a victory of one of the playing teams. If a team wins the match, it gets $$$w$$$ points, and the opposing team gets $$$0$$$ points. If the game results in a draw, both teams get $$$d$$$ points.The manager of the Berland capital team wants to summarize the results of the season, but, unfortunately, all information about the results of each match is lost. The manager only knows that the team has played $$$n$$$ games and got $$$p$$$ points for them.You have to determine three integers $$$x$$$, $$$y$$$ and $$$z$$$ — the number of wins, draws and loses of the team. If there are multiple answers, print any of them. If there is no suitable triple $$$(x, y, z)$$$, report about it.

The first line contains four integers $$$n$$$, $$$p$$$, $$$w$$$ and $$$d$$$ $$$(1 \le n \le 10^{12}, 0 \le p \le 10^{17}, 1 \le d < w \le 10^{5})$$$ — the number of games, the number of points the team got, the number of points awarded for winning a match, and the number of points awarded for a draw, respectively. Note that $$$w > d$$$, so the number of points awarded for winning is strictly greater than the number of points awarded for draw.

If there is no answer, print $$$-1$$$. Otherwise print three non-negative integers $$$x$$$, $$$y$$$ and $$$z$$$ — the number of wins, draws and losses of the team. If there are multiple possible triples $$$(x, y, z)$$$, print any of them. The numbers should meet the following conditions:    $$$x \cdot w + y \cdot d = p$$$,  $$$x + y + z = n$$$.

NoteOne of the possible answers in the first example — $$$17$$$ wins, $$$9$$$ draws and $$$4$$$ losses. Then the team got $$$17 \cdot 3 + 9 \cdot 1 = 60$$$ points in $$$17 + 9 + 4 = 30$$$ games.In the second example the maximum possible score is $$$10 \cdot 5 = 50$$$. Since $$$p = 51$$$, there is no answer.In the third example the team got $$$0$$$ points, so all $$$20$$$ games were lost.

//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");
    }
}

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);
    }
}

//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();
}

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 + 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);
    }
}


Sasha is a very happy guy, that's why he is always on the move. There are $$$n$$$ cities in the country where Sasha lives. They are all located on one straight line, and for convenience, they are numbered from $$$1$$$ to $$$n$$$ in increasing order. The distance between any two adjacent cities is equal to $$$1$$$ kilometer. Since all roads in the country are directed, it's possible to reach the city $$$y$$$ from the city $$$x$$$ only if $$$x < y$$$. Once Sasha decided to go on a trip around the country and to visit all $$$n$$$ cities. He will move with the help of his car, Cheetah-2677. The tank capacity of this model is $$$v$$$ liters, and it spends exactly $$$1$$$ liter of fuel for $$$1$$$ kilometer of the way. At the beginning of the journey, the tank is empty. Sasha is located in the city with the number $$$1$$$ and wants to get to the city with the number $$$n$$$. There is a gas station in each city. In the $$$i$$$-th city, the price of $$$1$$$ liter of fuel is $$$i$$$ dollars. It is obvious that at any moment of time, the tank can contain at most $$$v$$$ liters of fuel.Sasha doesn't like to waste money, that's why he wants to know what is the minimum amount of money is needed to finish the trip if he can buy fuel in any city he wants. Help him to figure it out!

The first line contains two integers $$$n$$$ and $$$v$$$ ($$$2 \le n \le 100$$$, $$$1 \le v \le 100$$$)  — the number of cities in the country and the capacity of the tank.

Print one integer — the minimum amount of money that is needed to finish the trip.

NoteIn the first example, Sasha can buy $$$2$$$ liters for $$$2$$$ dollars ($$$1$$$ dollar per liter) in the first city, drive to the second city, spend $$$1$$$ liter of fuel on it, then buy $$$1$$$ liter for $$$2$$$ dollars in the second city and then drive to the $$$4$$$-th city. Therefore, the answer is $$$1+1+2=4$$$.In the second example, the capacity of the tank allows to fill the tank completely in the first city, and drive to the last city without stops in other cities.

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);
}

#[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);
}

/*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);
}


There are $$$n$$$ students in a school class, the rating of the $$$i$$$-th student on Codehorses is $$$a_i$$$. You have to form a team consisting of $$$k$$$ students ($$$1 \le k \le n$$$) such that the ratings of all team members are distinct.If it is impossible to form a suitable team, print "NO" (without quotes). Otherwise print "YES", and then print $$$k$$$ distinct numbers which should be the indices of students in the team you form. If there are multiple answers, print any of them.

The first line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 100$$$) — the number of students and the size of the team you have to form. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 100$$$), where $$$a_i$$$ is the rating of $$$i$$$-th student.

If it is impossible to form a suitable team, print "NO" (without quotes). Otherwise print "YES", and then print $$$k$$$ distinct integers from $$$1$$$ to $$$n$$$ which should be the indices of students in the team you form. All the ratings of the students in the team should be distinct. You may print the indices in any order. If there are multiple answers, print any of them. Assume that the students are numbered from $$$1$$$ to $$$n$$$.

NoteAll possible answers for the first example:   {1 2 5}  {2 3 5}  {2 4 5} Note that the order does not matter.

use std::io;

fn read_vector() -> Vec<i32> {
	let mut input = String::new();
	io::stdin().read_line(&mut input).expect("Reading error");

	return input.split_whitespace().map(|s| s.trim().parse::<i32>().unwrap()).collect();
}

fn new_rank(ranks: &Vec<i32>, indexes: &Vec<i32>, rank: i32) -> bool {
	for ind in indexes {
		if ranks[*ind as usize] == rank {
			return false;
		}
	}
	return true;
}

fn main() {
	let nums = read_vector();
	let team_size = nums[1];

	let ranks = read_vector();
	let mut team = Vec::<i32>::new();

	for tup in ranks.iter().enumerate() {
		if new_rank(&ranks, &team, *tup.1) {
			team.push(tup.0 as i32);
		}
		if team.len() >= (team_size as usize) {
			break;
		}
	}

	if team.len() >= (team_size as usize) {
		println!("YES");
		for rank in team {
			print!("{} ", rank + 1);
		}
	} else {
		println!("NO");
	}
}

//spnauti-rust
use std::io::*;
use std::str::*;
use std::fmt::Debug;
#[allow(unused_imports)] use std::cmp::Ordering::*;
#[allow(unused_imports)] use std::collections::*;

#[allow(unused_macros)]
macro_rules! a {
    ($c: tt, $x: expr, $y: expr) => {{
        let b = $y; let a = &mut $x;
        if b $c *a { *a = b; true } else { false }
    }};
}
struct WordReader<'a> { it : SplitAsciiWhitespace<'a>, }
#[allow(dead_code)]
impl<'a> WordReader<'a> {
    fn new<T: Read>(b: &mut String, mut r: T) -> WordReader {
        b.clear();
        r.read_to_string(b).unwrap();
        WordReader { it: b.split_ascii_whitespace() }
    }
    fn from_stdin(b: &mut String) -> WordReader {
        WordReader::new(b, stdin())
    }
    fn sl(&mut self) ->  &str { self.it.next().unwrap() }
    fn bs(&mut self) -> &[u8] { self.sl().as_bytes()    }
    fn s(&mut self) -> String { String::from(self.sl()) }
    fn i(&mut self) ->    i32 { self.p()                }
    fn u(&mut self) ->  usize { self.p()                }
    fn vi(&mut self, n: usize) -> Vec<i32> {
        self.vp::<i32>(n)
    }
    fn p<T: FromStr>(&mut self) -> T where T::Err: Debug {
        self.sl().parse::<T>().unwrap()
    }
    fn vp<T: FromStr>(&mut self, n: usize) -> Vec<T> where T::Err: Debug {
        (0..n).map(|_| self.p()).collect()
    }
}

#[allow(dead_code)]
fn build_counting_hashmap<K: Eq + std::hash::Hash, T>(i: T) -> HashMap<K,usize>
    where T: Iterator<Item = K> {
    let mut m = HashMap::new();
    for k in i {
        let n = 1 + if let Some(&n) = m.get(&k) { n } else { 0 };
        m.insert(k, n);
    }
    m
}

fn main() {
    let mut bin = String::new();
    let mut input = WordReader::from_stdin(&mut bin);

    let n = input.u();
    let k = input.u();
    let res = input.vi(n).into_iter().enumerate().map(|(a,b)| (b,a)).collect::<HashMap<_,_>>();
    if res.len() < k {
        println!("NO");
    } else {
        println!("YES");
        for x in res.values().take(k) {
            print!("{} ", x + 1);
        }
    }
}

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

#[allow(unused_macros)]
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(),
      )+
    )
  }}
}

#[allow(unused_macros)]
macro_rules! readvec {
  ( $t:ty ) => {{
    let input = readln!();
    let mut input = input.split_whitespace();
    let mut result = Vec::new();
    for elem in input {
      result.push(elem.parse::<$t>().unwrap());
    }
    result
  }}
}

fn main() {
  let (n,k) = readln!(i32,i32);
  let a = readvec!(i32);
  let mut res = vec![n as usize;k as usize];
  for i in 0..k {
    for j in 0..n {
      let mut good = true;
      for kk in 0..i {
        if a[res[kk as usize]] == a[j as usize] {
          good = false;
          break;
        }
      }
      if good {
        res[i as usize] = j as usize;
        break;
      }
    }
    if res[i as usize] == n as usize{
      println!("NO");
      return;
    }
  }
  println!("YES");
  println!("{}",res.iter().map(|&x|(x+1).to_string()).collect::<Vec<String>>().join(" "));
}

use std::io;
use std::collections::HashMap;

fn main() {
    let mut l1 = String::new();
    let mut l2 = String::new();
    {
        let stdin = io::stdin();
        stdin.read_line(&mut l1).unwrap();
        stdin.read_line(&mut l2).unwrap();
    }

    let p: Vec<usize> = l1.trim()
        .split(" ")
        .map(|val| val.parse().unwrap())
        .collect();

    let mut k = p[1];

    let h: HashMap<usize, usize> = l2.trim()
        .split(" ")
        .map(|val| val.parse().unwrap())
        .enumerate()
        .map(|(a, b)| (b, a))
        .collect();

    // println!("{:?}", h);
    // println!("k: {}", k);
    // println!("h.len(): {}", h.len());

    if h.len() >= k {
        println!("YES");
        let mut hm_iter = h.iter();
        while k > 1 {
            k -= 1;

            print!("{} ", hm_iter.next().unwrap().1 + 1);
        }
        println!("{}", hm_iter.next().unwrap().1 + 1);
    } else {
        println!("NO");
    }
}

#![allow(unused_imports)]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_labels)]

use std::char::*;
use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::str::FromStr;

macro_rules! debug {($($a:expr),*) => {eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
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 ) * } } ; }
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 ) * } } ; }
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" ) } ; }

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::f64;

fn min<T: PartialOrd>(a:T, b:T) -> T {
    if a < b { a }
    else { b }
}

fn max<T: PartialOrd>(a:T, b:T) -> T {
    if a < b { b }
    else { a }
}

const MAX:usize = 30;
const INF:i64 = std::i64::MAX;
const MOD:i64 = 1e9 as i64 + 7;

struct Graph {
    e: Vec<Vec<usize>>,
    v: Vec<usize>,
    u: Vec<usize>,
    f: Vec<bool>,
    c: i64,
    vc: Vec<i64>,
}

impl Graph {
    fn new(n:usize) -> Self {
        Graph {
            e: vec![vec![];n],
            v: vec![],
            u: vec![n;n],
            f: vec![false;n],
            c: 0,
            vc: vec![0;n],
        }
    }

    fn dfs(&mut self, crt: usize) {
        if self.f[crt] { return; }
        self.c += 1;
        self.f[crt] = true;
        self.v.push(crt);
        self.vc[crt] = self.c;
        self.u[crt] = self.v.len()-1;
        for i in 0..self.e[crt].len() {
            self.dfs(self.e[crt][i]);
        }
        //debug!(crt, self.c, self.vc[crt]);
        self.vc[crt] = self.c - self.vc[crt];
    }
}

fn main() {
    //let t:usize = read();

    //'outer: for _ in 0..t {
        let n:usize = read();
        let k:usize = read();
        let a:Vec<i64> = (0..n).map(|_| read()).collect();

        let mut f = vec![false;101];
        let mut cnt = 0;
        let mut v = vec![];
        for i in 0..n {
            if !f[a[i] as usize] {
                cnt += 1;
                v.push(i);
                f[a[i] as usize] = true;
            }
            if cnt == k { break; }
        }

        if cnt != k { println!("NO"); return; }
        println!("YES");
        for e in v {print!("{} ", e+1); } println!();

    //}
}

/*

*/

use std::collections::HashMap;

pub fn main() {
    let mut input = io::Input::new();

    let mut map = HashMap::new();

    let n = input.next::<i32>();
    let k = input.next::<usize>();

    for i in 1..(n+1) {
        let a = input.next::<i32>();
        map.entry(a).or_insert(i);
        if map.len() == k {
            break;
        }
    }

    if map.len() == k {
        println!("YES");

        let mut v = Vec::new();

        for (_, u) in map {
            v.push(u);
        }

        v.sort();

        for u in v {
            print!("{} ", u);
        }
        println!();
    } else {
        println!("NO");
    }
}

#[allow(unused)]
pub mod io {

    const BUFFER_SIZE: usize = 8192;

    use std::collections::VecDeque;
    use std::str::FromStr;
    use std::io;
    use std::io::Read;

    type AsciiStr = Vec<u8>;

    pub struct Input {
        token_buffer: VecDeque<String>,
        remaining: String,
    }

    impl Input {

        pub fn new() -> Input {
            Input {
                token_buffer: VecDeque::with_capacity(100),
                remaining: String::new(),
            }
        }

        pub fn next<T: FromStr>(&mut self) -> T
            where T::Err: ::std::fmt::Debug
        {
            self.fill_buffer();
            self.token_buffer.pop_front().unwrap().parse().unwrap()
        }

        pub fn next_ascii_string(&mut self) -> AsciiStr {
            self.fill_buffer();
            Vec::from(self.token_buffer.pop_front().unwrap().as_bytes())
        }

        fn fill_buffer(&mut self) {
            while self.token_buffer.is_empty() {
                let mut minibuffer = [0u8; BUFFER_SIZE];
                let size = io::stdin().read(&mut minibuffer[..]).unwrap();

                self.remaining += &String::from_utf8_lossy(&minibuffer[..size]);

                if self.remaining.trim().len() > 0 {
                    for token in self.remaining.trim().split_whitespace() {
                        self.token_buffer.push_back(String::from(token))
                    }

                    if size > 0 && ! self.remaining.ends_with(|c: char|char::is_ascii_whitespace(&c)) {
                        self.remaining = self.token_buffer.pop_back().unwrap();
                    } else {
                        self.remaining.clear();
                    }

                } else if size == 0 {
                    panic!("EOF");
                }
            }
        }
    }
}

use std::collections::HashMap;
use std::io;

fn main()
{
    let mut line1 = String::new();
    let mut line2 = String::new();
    let mut team = HashMap::new();

    io::stdin().read_line(&mut line1).unwrap();
    io::stdin().read_line(&mut line2).unwrap();
    let nums: Vec<&str> = line1.trim().split_whitespace().collect();
    let rates: Vec<&str> = line2.trim().split_whitespace().collect();

    for i in 0..nums[0].parse().unwrap()
    {
        team.insert(rates[i], i + 1);
    }
    if team.len() < nums[1].parse().unwrap()
    {
        println!("{}", "NO");
        return;
    }
    else
    {
        println!("{}", "YES");
    }

    let mut it = team.iter();
    for _i in 0..nums[1].parse().unwrap()
    {
        if let Some((_, &output)) = it.next()
        {
            print!("{} ", output);
        }
    }

    print!("\n");
}

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

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

    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 mut line = String::new();
            std::io::stdin().read_line(&mut line).expect("Fail to read");
            self.buffer = line.split_whitespace().map(String::from).collect();
        }
    }
}

fn _main() {
    let mut scan = Scan::new();
    let n: usize = scan.next();
    let m: usize = scan.next();
    let mut arr: Vec<(usize, usize)> = vec![];
    let mut result: Vec<usize> = vec![];
    for i in 1..=n {
        let current: usize = scan.next();
        arr.push((current, i));
    }
    arr.sort();
    result.push(arr[0].1);
    for i in 1..n {
        if arr[i].0 != arr[i - 1].0 {
            result.push(arr[i].1);
            if result.len() == m {
                break;
            }
        }
    }
    if result.len() < m {
        println!("NO");
    } else {
        println!("YES");
        for &item in result.iter() {
            print!("{} ", item);
        }
        println!();
    }
}

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

use std::collections::BTreeSet;
use std::collections::BTreeMap;
use std::io;
use std::io::Stdin;
use std::str::FromStr;

fn read_line(stdin : &Stdin, line : &mut String) {
    match stdin.read_line(line) {
        Ok(_) => return,
        Err(msg) => panic!("Could not read line! Message: {}.", msg),
    }
}

fn parse_t<T : FromStr>(s : &str) -> T {
    match s.trim().parse() {
        Ok(y) => y,
        Err(_) => panic!("Could not read from string!"),
    }
}

fn read_ts<T : FromStr>(stdin : &Stdin, ts : &mut Vec<T>) {
    let mut line = String::new();
    read_line(stdin, &mut line);
    let word_iter = line.split_whitespace();
    for word in word_iter {
        let x = parse_t(word);
        ts.push(x);
    }
}

fn print_can_form_team(k : usize, ratings : &Vec<u64>) {
    let mut rating_index_map = BTreeMap::new();
    let mut index = 1;
    let mut distinct_ratings = BTreeSet::new();
    for rating in ratings {
        distinct_ratings.insert(rating);
        if rating_index_map.contains_key(&rating) {
            // Do nothing ...
        } else {
            rating_index_map.insert(rating, index);
        }
        index = index + 1;
    }
    let num_distinct_ratings = distinct_ratings.len();
    if num_distinct_ratings >= k {
        println!("YES");
        let mut i = 0;
        let mut is_first = true;
        for rating in distinct_ratings {
            if i < k {
                if is_first {
                    is_first = false;
                } else {
                    print!(" ");
                }
                print!("{}", rating_index_map.get(rating).unwrap());
            } else {
                break;
            }
            i = i + 1;
        }
        println!();
    } else {
        println!("NO");
    }
}

fn main() {
    let stdin = io::stdin();
    let mut n_k = vec![];
    read_ts(&stdin, &mut n_k);
    let k = n_k[1];
    let mut ratings = vec![];
    read_ts(&stdin, &mut ratings);
    print_can_form_team(k, &ratings);
}

use std::collections::HashMap;
use std::io::{self, BufRead, Write, stdin};

fn main() {

    let mut line = String::new();
    stdin().read_line(&mut line).ok();
    let params: Vec<i32> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();

    let k = params[1];

    let mut oline = String::new();
    stdin().read_line(&mut oline).ok();
    let elems: Vec<i32> = oline.split_whitespace().map(|s| s.parse().unwrap()).collect();

    let mut numbers = HashMap::new();
    for (pos, el) in elems.iter().enumerate() {
        if ! numbers.contains_key(el) {
            numbers.insert(el, pos);
        }
    }

    if (numbers.len() as i32) < k {
        println!("NO");
    } else {
        println!("YES");
        let mut i = 1;
        for (_, val) in numbers.iter() {
            if i > k {
                break;
            }
            if i == 1 {
                print!("{}", val + 1);
            } else {
                print!(" {}", val + 1);
            }
            i += 1;
        }
        io::stdout().flush().unwrap();
    }
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn solve() {
    let n = get();
    let k = get();
    let mut hm = HashMap::new();
    for i in 0 .. n {
        let rat: i64 = get();
        hm.insert(rat, i + 1);
    }
    if hm.len() < k {
        println!("NO");
    } else {
        println!("YES");
        let mut it = hm.iter();
        for i in 0 .. k {
            if let Some((_, x)) = it.next() {
                print!("{}{}", x, if i == k - 1 { "\n" } else { " " });
            }
        }
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

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

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

    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 mut line = String::new();
            std::io::stdin().read_line(&mut line).expect("Fail to read");
            self.buffer = line.split_whitespace().map(String::from).collect();
        }
    }
}

fn _main() {
    let mut scan = Scan::new();
    let n: usize = scan.next();
    let m: usize = scan.next();
    let mut arr: Vec<(usize, usize)> = vec![];
    let mut result: Vec<usize> = vec![];
    for i in 1..=n {
        let current: usize = scan.next();
        arr.push((current, i));
    }
    arr.sort();
    result.push(arr[0].1);
    for i in 1..n {
        if arr[i].0 != arr[i - 1].0 {
            result.push(arr[i].1);
            if result.len() == m {
                break;
            }
        }
    }
    if result.len() < m {
        println!("NO");
    } else {
        for &item in result.iter() {
            print!("{} ", item);
        }
        println!();
    }
}

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

use std::collections::HashMap;
use std::io::{self, BufRead, Write, stdin};

fn main() {

    let mut line = String::new();
    stdin().read_line(&mut line).ok();
    let params: Vec<i32> = line.split_whitespace().map(|s| s.parse().unwrap()).collect();

    let k = params[1];

    let mut oline = String::new();
    stdin().read_line(&mut oline).ok();
    let elems: Vec<i32> = oline.split_whitespace().map(|s| s.parse().unwrap()).collect();

    let mut numbers = HashMap::new();
    for (pos, el) in elems.iter().enumerate() {
        if ! numbers.contains_key(el) {
            numbers.insert(el, pos);
        }
    }

    if (numbers.len() as i32) < k {
        println!("NO");
    } else {
        println!("YES");
        let mut i = 1;
        for (_, val) in numbers.iter() {
            if i == 1 {
                print!("{}", val + 1);
            } else {
                print!(" {}", val + 1);
            }
            i += 1;
        }
        io::stdout().flush().unwrap();
    }
}


One Sunday Petr went to a bookshop and bought a new book on sports programming. The book had exactly n pages.Petr decided to start reading it starting from the next day, that is, from Monday. Petr's got a very tight schedule and for each day of the week he knows how many pages he will be able to read on that day. Some days are so busy that Petr will have no time to read whatsoever. However, we know that he will be able to read at least one page a week.Assuming that Petr will not skip days and will read as much as he can every day, determine on which day of the week he will read the last page of the book.

The first input line contains the single integer n (1 ≤ n ≤ 1000) — the number of pages in the book. The second line contains seven non-negative space-separated integers that do not exceed 1000 — those integers represent how many pages Petr can read on Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday correspondingly. It is guaranteed that at least one of those numbers is larger than zero.

Print a single number — the number of the day of the week, when Petr will finish reading the book. The days of the week are numbered starting with one in the natural order: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.

NoteNote to the first sample:By the end of Monday and therefore, by the beginning of Tuesday Petr has 85 pages left. He has 65 pages left by Wednesday, 45 by Thursday, 30 by Friday, 20 by Saturday and on Saturday Petr finishes reading the book (and he also has time to read 10 pages of something else).Note to the second sample:On Monday of the first week Petr will read the first page. On Monday of the second week Petr will read the second page and will finish reading the book.

use std::io;

fn raw_input() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().to_string()
}

fn input_split() -> Vec<u16> {
    raw_input()
        .split_whitespace()
        .map(|elem| elem.parse().unwrap())
        .collect()
}

fn input() -> u16 {
    raw_input().parse().unwrap()
}

fn main() {
    let mut n = input();
    let days = input_split();

    let week_total: u16 = days.iter().sum();
    while n > week_total {
        n -= week_total;
    }

    let mut current_day = 0;
    loop {
        if days[current_day] >= n {
            break;
        } else {
            n -= days[current_day];
        }
        current_day += 1;
    }

    print!("{}", current_day + 1);
}

#[allow(unused_imports)]
use std::cmp::{min,max};
use std::collections::{*};
use std::io::{BufWriter, stdin, stdout, Write};
const BITS: usize = 19;

#[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 scanner = Scanner::default();
    let mut n: u128 = scanner.next();
    let mut week: Vec<u128> = (1..=7).map(|_| scanner.next()).collect();
    let mut cur: u128 = 0;
    let mut i: usize = 0;
    while cur < n {
    	cur += week[i];
    	if cur >= n {
    		println!["{}", i+1];
    	}
    	i += 1;
    	i %= 7;
    }
}

fn main() {
    let n: u32 = get_input().parse().unwrap();
    let days: Vec<u32> = get_input().split_ascii_whitespace().map(|v| v.parse().unwrap()).collect();
    let total: u32 = days.iter().sum();
    //println!("total is {}", total);
    let m =  {
        if total > n {
            n
        } else if total == n || n % total == 0 {
            total
        } else {
            n % total
        }
    };

    let mut c = 0;

    //println!("mod is {}", m);
    for i in 0..days.len() {
        //println!("c is {}", c);
        c += days[i];

        if c >= m {
            println!("{}", i+1);
            break;
        }
    }
}

fn get_input() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Failed");
    buffer.trim().to_owned()
}

fn get_input_usize() -> usize {
    get_input().parse().unwrap()
}

use std::io;

// type Matrix = Vec<Vec<char>>;

fn read_line() -> String {
    let mut input_line = String::new();
    io::stdin().read_line(&mut input_line).unwrap();
    return String::from(input_line.trim());
}

fn read_line_vec() -> Vec<u32> {
    return read_line().split(' ')
        .map(|s| s.parse().unwrap())
        .collect();
}

fn main() {
    let mut n: u32 = read_line().parse().unwrap();
    let week = read_line_vec();
    let s: u32 = week.iter().sum();

    n = ((n - 1) % s) + 1;

    for i in 0..week.len() {
        if n <= week[i] {
            println!("{}", i + 1);
            break;
        }
        n -= week[i];
    }

}

fn main() {
    let n: u32 = get_input().parse().unwrap();
    let days: Vec<u32> = get_input().split_ascii_whitespace().map(|v| v.parse().unwrap()).collect();
    let total: u32 = days.iter().sum();
    //println!("total is {}", total);
    let m =  {
        if total > n {
            n % total
        } else if total == n {
            n
        } else {
            n - total
        }
    };

    let mut c = 0;

    //println!("mod is {}", m);
    for i in 0..days.len() {
        //println!("c is {}", c);
        c += days[i];

        if c >= m {
            println!("{}", i+1);
            break;
        }
    }
}

fn get_input() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Failed");
    buffer.trim().to_owned()
}

fn get_input_usize() -> usize {
    get_input().parse().unwrap()
}

fn main() {
    let n: u32 = get_input().parse().unwrap();
    let days: Vec<u32> = get_input().split_ascii_whitespace().map(|v| v.parse().unwrap()).collect();
    let total: u32 = days.iter().sum();
    //println!("total is {}", total);
    let m =  {
        if total > n {
            n
        } else if total == n {
            n
        } else {
            total
        }
    };

    let mut c = 0;

    //println!("mod is {}", m);
    for i in 0..days.len() {
        //println!("c is {}", c);
        c += days[i];

        if c >= m {
            println!("{}", i+1);
            break;
        }
    }
}

fn get_input() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Failed");
    buffer.trim().to_owned()
}

fn get_input_usize() -> usize {
    get_input().parse().unwrap()
}

fn main() {
    let n: u32 = get_input().parse().unwrap();
    let days: Vec<u32> = get_input().split_ascii_whitespace().map(|v| v.parse().unwrap()).collect();
    let total: u32 = days.iter().sum();

    let m =  {
        if total == n {
            n
        } else {
            n % total
        }
    };

    let mut c = 0;
    for i in 0..days.len() {
        c += days[i];

        if c >= m {
            println!("{}", i+1);
            break;
        }
    }
}

fn get_input() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Failed");
    buffer.trim().to_owned()
}

fn get_input_usize() -> usize {
    get_input().parse().unwrap()
}

fn main() {
    let n: u32 = get_input().parse().unwrap();
    let days: Vec<u32> = get_input().split_ascii_whitespace().map(|v| v.parse().unwrap()).collect();
    let total: u32 = days.iter().sum();

    let m =  {
        if total > n {
            n % total
        } else if total == n {
            n
        } else {
            total % n
        }
    };

    let mut c = 0;
    for i in 0..days.len() {
        c += days[i];

        if c >= m {
            println!("{}", i+1);
            break;
        }
    }
}

fn get_input() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Failed");
    buffer.trim().to_owned()
}

fn get_input_usize() -> usize {
    get_input().parse().unwrap()
}

fn main() {
    let n: u32 = get_input().parse().unwrap();
    let days: Vec<u32> = get_input().split_ascii_whitespace().map(|v| v.parse().unwrap()).collect();
    let total: u32 = days.iter().sum();
    //println!("total is {}", total);
    let m =  {
        if total > n {
            total % n
        } else if total == n {
            n
        } else {
            n % total
        }
    };

    let mut c = 0;

    //println!("mod is {}", m);
    for i in 0..days.len() {
        //println!("c is {}", c);
        c += days[i];

        if c >= m {
            println!("{}", i+1);
            break;
        }
    }
}

fn get_input() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Failed");
    buffer.trim().to_owned()
}

fn get_input_usize() -> usize {
    get_input().parse().unwrap()
}

fn main() {
    let n: u32 = get_input().parse().unwrap();
    let days: Vec<u32> = get_input().split_ascii_whitespace().map(|v| v.parse().unwrap()).collect();
    let total: u32 = days.iter().sum();

    let m =  {
        if total == n {
            n
        } else {
            n % total
        }
    };

    let mut c = 0;

    println!("mod is {}", m);
    for i in 0..days.len() {
        println!("c is {}", c);
        c += days[i];

        if c >= m {
            println!("{}", i+1);
            break;
        }
    }
}

fn get_input() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Failed");
    buffer.trim().to_owned()
}

fn get_input_usize() -> usize {
    get_input().parse().unwrap()
}

fn main() {
    let n: u32 = get_input().parse().unwrap();
    let days: Vec<u32> = get_input().split_ascii_whitespace().map(|v| v.parse().unwrap()).collect();
    let total: u32 = days.iter().sum();

    let m =  n % total;

    let mut c = 0;
    for i in 0..days.len() {
        c += days[i];

        if c >= m {
            println!("{}", i+1);
            break;
        }
    }
}

fn get_input() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Failed");
    buffer.trim().to_owned()
}

fn get_input_usize() -> usize {
    get_input().parse().unwrap()
}

fn main() {
    let n: u32 = get_input().parse().unwrap();
    let days: Vec<u32> = get_input().split_ascii_whitespace().map(|v| v.parse().unwrap()).collect();
    let total: u32 = days.iter().sum();
    //println!("total is {}", total);
    let m =  {
        if total > n {
            n
        } else if total == n {
            n
        } else {
            n % total
        }
    };

    let mut c = 0;

    //println!("mod is {}", m);
    for i in 0..days.len() {
        //println!("c is {}", c);
        c += days[i];

        if c >= m {
            println!("{}", i+1);
            break;
        }
    }
}

fn get_input() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Failed");
    buffer.trim().to_owned()
}

fn get_input_usize() -> usize {
    get_input().parse().unwrap()
}


You have $$$n \times n$$$ square grid and an integer $$$k$$$. Put an integer in each cell while satisfying the conditions below.  All numbers in the grid should be between $$$1$$$ and $$$k$$$ inclusive.  Minimum number of the $$$i$$$-th row is $$$1$$$ ($$$1 \le i \le n$$$).  Minimum number of the $$$j$$$-th column is $$$1$$$ ($$$1 \le j \le n$$$). Find the number of ways to put integers in the grid. Since the answer can be very large, find the answer modulo $$$(10^{9} + 7)$$$.  These are the examples of valid and invalid grid when $$$n=k=2$$$.

The only line contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le n \le 250$$$, $$$1 \le k \le 10^{9}$$$).

Print the answer modulo $$$(10^{9} + 7)$$$.

NoteIn the first example, following $$$7$$$ cases are possible.  In the second example, make sure you print the answer modulo $$$(10^{9} + 7)$$$.

#![allow(unused_imports)]
use std::io::{BufReader, BufWriter, stdin, stdout, Write};
use std::cmp::{min, max};
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet, BinaryHeap};

const m:i64 = 1000000007;

fn main() {
	let mut inp = Iinput::default();
	let out = &mut BufWriter::new(stdout());
	let n:usize = inp.scan::<usize>();
	let k:i64 = inp.scan::<i64>();
	let mut nCr = vec![vec![0 as i64; n + 1]; n + 1];
	nCr[0][0] = 1;
	for i in 1..n+1 {
		for j in 0..i+1 {
			if j > 0 {
				nCr[i][j] += nCr[i - 1][j - 1];
			}
			if j < i {
				nCr[i][j] += nCr[i - 1][j];
			}
			nCr[i][j] %= m;
		}
	}
	let mut dp = vec![0; n + 1];
	dp[0] = 1;
	let mut pow2 = vec![1 as i64; n + 1];
	for i in 1..n+1 {
		pow2[i] = pow2[i - 1] * (k - 1) % m;
	}
	for _row in 0..n {
		let mut tp = vec![0; n + 1];
		let mut powa = 1 as i64;
		for i in 0..n+1 {
			for j in i..n+1 {
				let mut val = pow2[n - j] * powa % m;
				if i == j {
					val += m - pow2[n];
				}
				val = val * nCr[n - i][n - j] % m;
				tp[j] = (tp[j] + val * dp[i]) % m;
			}
			powa = powa * k % m;
		}
		dp = tp;
	}
	writeln!(out, "{}", dp[n]);
}

#[derive(Default)]
struct Iinput {
	buffer: Vec<String>
}

impl Iinput {
	fn scan<T: std::str::FromStr>(&mut self) -> T {
		loop {
			if let Some(token) = self.buffer.pop() {
				return token.parse().ok().expect("Parsing Error");
			}
			let mut s = String::new();
			stdin().read_line(&mut s).expect("Reading Error");
			self.buffer = s.split_whitespace().rev().map(String::from).collect();
		}
	}
}

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

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

    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 try_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())
                }
            }
        }

        pub fn token<T>(&mut self) -> T
            where T: FromStr,
                  <T as FromStr>::Err: 'static + std::error::Error
        {
            self.try_token().unwrap()
        }
    }
}

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

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

const M: u64 = 1e9 as u64 + 7;

fn solve<R: BufRead, W: Write>(mut scan: Scanner<R>, mut output: W) {
    let n: u64 = scan.token();
    let k: u64 = scan.token();
    let k_1 = k - 1;
    let kp3 = mpow(k_1, n);
    let mut sum = mpow((mpow(k, n) + (M - kp3)) % M, n);
    let mut bcf = 1;
    let mut kp2 = 1;
    for i in 1..=n {
        bcf = (n - i + 1) * mpow(i, M - 2) % M * bcf % M;
        let kp1 = mpow(k, n - i);
        kp2 = kp2 * k_1 % M;
        sum = (sum + mpow(M - 1, i & 1) * bcf % M * mpow((kp1 * kp2 % M + (M - kp3)) % M, n) % M) % M;
    }
    writeln!(output, "{}", sum).unwrap();
}

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

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

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

    #[test]
    fn example2() {
        t!("123 456789\n", "689974806\n");
    }
}

// ---------- begin ModInt ----------
const MOD: u32 = 1_000_000_007;

#[derive(Clone, Copy)]
struct ModInt(u32);

impl std::ops::Add for ModInt {
    type Output = ModInt;
    fn add(self, rhs: ModInt) -> Self::Output {
        let mut d = self.0 + rhs.0;
        if d >= MOD {
            d -= MOD;
        }
        ModInt(d)
    }
}

impl std::ops::AddAssign for ModInt {
    fn add_assign(&mut self, rhs: ModInt) {
        *self = *self + rhs;
    }
}

impl std::ops::Sub for ModInt {
    type Output = ModInt;
    fn sub(self, rhs: ModInt) -> Self::Output {
        let mut d = self.0 + MOD - rhs.0;
        if d >= MOD {
            d -= MOD;
        }
        ModInt(d)
    }
}

impl std::ops::SubAssign for ModInt {
    fn sub_assign(&mut self, rhs: ModInt) {
        *self = *self - rhs;
    }
}

impl std::ops::Mul for ModInt {
    type Output = ModInt;
    fn mul(self, rhs: ModInt) -> Self::Output {
        ModInt((self.0 as u64 * rhs.0 as u64 % MOD as u64) as u32)
    }
}

impl std::ops::MulAssign for ModInt {
    fn mul_assign(&mut self, rhs: ModInt) {
        *self = *self * rhs;
    }
}

impl std::ops::Neg for ModInt {
    type Output = ModInt;
    fn neg(self) -> Self::Output {
        ModInt(if self.0 == 0 {0} else {MOD - self.0})
    }
}

/*
impl std::fmt::Display for ModInt {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.0)
    }
}
*/

#[allow(dead_code)]
impl ModInt {
    pub fn new(n: u32) -> ModInt {
        ModInt(n % MOD)
    }
    pub fn zero() -> ModInt {
        ModInt(0)
    }
    pub fn one() -> ModInt {
        ModInt(1)
    }
    pub fn pow(self, mut n: u32) -> ModInt {
        let mut t = ModInt::one();
        let mut s = self;
        while n > 0 {
            if n & 1 == 1 {
                t *= s;
            }
            s *= s;
            n >>= 1;
        }
        t
    }
    pub fn inv(self) -> ModInt {
        self.pow(MOD - 2)
    }
    pub fn comb(n: u32, k: u32) -> ModInt {
        if k > n {
            return ModInt::zero();
        }
        let k = std::cmp::min(k, n - k);
        let mut nu = ModInt::one();
        let mut de = ModInt::one();
        for i in 0..k {
            nu *= ModInt(n - i);
            de *= ModInt(i + 1);
        }
        nu * de.inv()
    }
}

#[allow(dead_code)]
struct Precalc {
    inv: Vec<ModInt>,
    fact: Vec<ModInt>,
    ifact: Vec<ModInt>,
}

#[allow(dead_code)]
impl Precalc {
    pub fn new(n: usize) -> Precalc {
        let mut inv = vec![ModInt::one(); n + 1];
        let mut fact = vec![ModInt::one(); n + 1];
        let mut ifact = vec![ModInt::one(); n + 1];
        for i in 2..(n + 1) {
            inv[i] = -inv[MOD as usize % i] * ModInt(MOD / i as u32);
            fact[i] = fact[i - 1] * ModInt(i as u32);
            ifact[i] = ifact[i - 1] * inv[i];
        }
        Precalc {
            inv: inv,
            fact: fact,
            ifact: ifact,
        }
    }
    pub fn inv(&self, n: usize) -> ModInt {
        self.inv[n]
    }
    pub fn fact(&self, n: usize) -> ModInt {
        self.fact[n]
    }
    pub fn ifact(&self, n: usize) -> ModInt {
        self.ifact[n]
    }
    pub fn comb(&self, n: usize, k: usize) -> ModInt {
        if k > n {
            return ModInt::zero();
        }
        self.fact[n] * self.ifact[k] * self.ifact[n - k]
    }
}
// ---------- end ModInt ----------
//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: usize,
        k: u32,
    }
    let mut ans = ModInt::zero();
    let pc = Precalc::new(n);
    for i in 0..=n {
        for j in 0..=n {
            let v = (n - i) * (n - j);
            let way = ModInt(k).pow(v as u32) * ModInt(k - 1).pow((n * n - v) as u32);
            ans += ModInt(MOD - 1).pow((i + j) as u32) * pc.comb(n, i) * pc.comb(n, j) * way;
        }
    }
    println!("{}", ans.0);
}

fn main() {
    run();
}

pub struct Scanner {
  buffer: Vec<String>
}

impl Scanner {
  pub fn new() -> Scanner {
    Scanner { buffer: Vec::new() }
  }

  pub 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();
      std::io::stdin().read_line(&mut input).expect("Failed read");
      self.buffer = input.split_whitespace().rev().map(String::from).collect();
    }
  }
}

const MOD: u64 = 1_000_000_007;

fn bin_pow(mut a: u64, mut n: u64) -> u64 {
  let mut x: u64 = 1;
  while n > 0 {
    if (n & 1) == 1 {
      x = x * a % MOD;
    }
    a = a * a % MOD;
    n >>= 1;
  }
  return x;
}

fn rev(a: u64) -> u64 {
  return bin_pow(a, MOD - 2);
}

fn main() {
  let mut scan = Scanner::new();
  let n: usize = scan.next();
  let x: usize = scan.next();

  let mut f: Vec<u64> = vec![0; 1000];
  f[0] = 1;
  for i in 1..1000 {
    f[i] = f[i - 1] * (i as u64) % MOD;
  }

  let mut rf: Vec<u64> = vec![0; 1000];
  for i in 0..1000 {
    rf[i] = rev(f[i]);
  }

  let mut px: Vec<u64> = vec![0; 1000];
  px[0] = 1;
  for i in 1..1000 {
    px[i] = px[i - 1] * ((x-1) as u64) % MOD;
  }

  let c = |n, k|{ f[n] * rf[n-k] % MOD * rf[k] % MOD };

  let mut dp: Vec<Vec<u64>> = vec![vec![0; n + 1]; n + 1];
  dp[0][0] = 1;
  for ones_now in 1..(n+1) {
    for ones_before in 0..(ones_now+1) {
      let mut ways: u64 = 0;
      for place_non_one in 0..std::cmp::min(ones_before + 1, ones_now) {
        ways += px[place_non_one] * rf[place_non_one] % MOD * rf[ones_before - place_non_one] % MOD;
      }
      ways %= MOD;
      ways = ways * f[ones_before] % MOD;
      ways = ways * c(n-ones_before, ones_now-ones_before) % MOD;
      ways = ways * px[n-ones_now] % MOD;
      for i in 1..(n+1) {
        dp[i][ones_now] = (dp[i][ones_now] + dp[i-1][ones_before] * ways) % MOD;
      }
    }
  }

  println!("{}", dp[n][n]);
}