#![allow(dead_code, unused_mut)] #![allow(non_snake_case)] macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); input_inner!{iter, $($r)*} }; ($($r:tt)*) => { let mut 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::>() }; ($iter:expr, chars) => { read_value!($iter, String).chars().collect::>() }; ($iter:expr, usize1) => { read_value!($iter, usize) - 1 }; ($iter:expr, $t:ty) => { $iter.next().unwrap().parse::<$t>().expect("Parse error") }; } fn main() { input!{ x: i64, y: i64 } let x = x.abs() as u64; let y = y.abs() as u64; let g = gcd(x, y); let mut res = 0.0; if g == 0 { println!("0"); return; } else if x == y { for i in 0..=10 { if i * g > 100 { break; } res += 1. / ((i * g * 2 + 2) as f64).powi((i * g * 2 + 2) as i32) } } else { for i in 0..=10 { for j in 0..=10 { if (i + j) * g > 100 { break; } res += 1. / ((i * g + j * g + 2) as f64).powi((i * g + j * g + 2) as i32) } } } println!("{}", res); } fn gcd(mut x: u64, mut y: u64) -> u64 { while y > 0 { x %= y; std::mem::swap(&mut x, &mut y); } x }