#[allow(unused_macros)] // https://earthly.dev/blog/rust-macros/ macro_rules! exit_with_print { ($x: expr) => { println!("{}", $x); exit(0); }; } fn main() { let mut out = BufWriter::new(stdout().lock()); input! {t: usize} for _ in 0 .. t { //input! {a: i64, b: i64, c: i64, x: i64, y: i64, z: i64} input! {inp: [i64; 6]} let posa = (inp[1] - inp[0]).abs() * inp[4] + (inp[2] - inp[0]).abs() * inp[5]; let posb = (inp[1] - inp[0]).abs() * inp[3] + (inp[2] - inp[1]).abs() * inp[5]; let posc = (inp[2] - inp[0]).abs() * inp[3] + (inp[2] - inp[1]).abs() * inp[4]; writeln!(out, "{} ", min(posa, min(posb, posc))).unwrap(); } } #[allow(unused_imports)] use { //ac_library::*, //itertools::Itertools, proconio::{fastout, input, marker::Bytes, marker::Chars, marker::Usize1}, //rustc_hash::{FxHashMap, FxHashSet}, std::{ cmp::{max, min, Reverse}, collections::{BTreeMap, BinaryHeap, VecDeque}, convert::TryInto, io::{self, stdout, BufRead, BufWriter, Write}, num::*, ops::BitXor, process::exit, }, };