use std::collections::{HashMap, HashSet}; use proconio::marker::Chars; fn main() { proconio::input! { n: u32, mut a: [String;n], } let a = a .into_iter() .map(|s| { let s = s.split('.').collect::>(); if s.len() == 1 { [s[0].parse::().unwrap(), 0] } else { [ s[0].parse::().unwrap(), s[1].parse::().unwrap() * (10i128).pow(10 - s[1].len() as u32), ] } }) .collect::>(); for a in a.iter() { eprintln!("{a:?}"); } let mut x = 0; let mut y = 0; for [i, j] in a { if i < 0 { y = j - y; if y < 0 { y += 10000000000; x -= 1; } x = i - x; } else { y += j; x += i; } } println!("{}.{:010}", x, y); }