#![allow(dead_code)] #![allow(unused_imports)] #![allow(non_snake_case)] #![allow(unused_variables)] pub mod scanner { pub struct Scanner { buf: Vec, } impl Scanner { pub fn new() -> Self { Self { buf: vec![] } } pub fn new_from(source: &str) -> Self { let source = String::from(source); let buf = Self::split(source); Self { buf } } pub fn next(&mut self) -> T { loop { if let Some(x) = self.buf.pop() { return x.parse().ok().expect(""); } let mut source = String::new(); std::io::stdin().read_line(&mut source).expect(""); self.buf = Self::split(source); } } fn split(source: String) -> Vec { source .split_whitespace() .rev() .map(String::from) .collect::>() } } } use crate::scanner::Scanner; use std::collections::*; const UINF: usize = std::usize::MAX; const IINF: isize = std::isize::MAX; const UMOD: usize = 998244353; //const UMOD: usize = 1000000007; const IMOD: isize = 998244353; //const IMOD: isize = 1000000007; fn yn(flag: bool) { if flag { println!("Yes") } else { println!("No") } } fn YN(flag: bool) { if flag { println!("YES") } else { println!("NO") } } fn print_vec(a: &Vec, sep: &str) { if a.is_empty() { println!("") } else { let dst: Vec = a.iter().map(|x| x.to_string()).collect(); println!("{}", dst.join(sep)); } } fn main() { let mut scanner = Scanner::new(); let t = 1; for _ in 0..t { solve(&mut scanner); } } fn solve(scanner: &mut Scanner) { let mut p = HashSet::new(); for i in 1..=60 { p.insert(2_usize.pow(i)); } let mut n: usize = scanner.next(); let mut ans = Vec::new(); while n > 1 { if n > 1e18 as usize { println!("ng"); } if n % 2 == 0 { n /= 2; ans.push('/'); } else { if p.contains(&(3*n+1)) { n = 3 * n + 1; ans.push('+'); } else { n = 3 * n - 1; ans.push('-'); } } } println!("{}", ans.len()); print_vec(&ans, ""); }