#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; pair add(long long a1, long long b1, long long a2, long long b2) { a1 += a2; b1 += b2; if(b1 >= 10000000000LL){ ++ a1; b1 -= 10000000000LL; } return make_pair(a1, b1); } pair sub(long long a1, long long b1, long long a2, long long b2) { a1 -= a2; b1 -= b2; if(b1 < 0){ -- a1; b1 += 10000000000LL; } return make_pair(a1, b1); } int main() { int n; cin >> n; bool sign = true; long long a = 0; long long b = 0; for(int i=0; i> s; int k = s.find('.'); bool sign2 = s[0] != '-'; long long a2, b2; if(k == string::npos){ if(sign2) a2 = stoll(s); else a2 = stoll(s.substr(1)); b2 = 0; } else{ string x = s.substr(0, k); string y = s.substr(k+1); y.resize(10, '0'); if(sign2) a2 = stoll(x); else a2 = stoll(x.substr(1)); b2 = stoll(y); } if(sign == sign2){ tie(a, b) = add(a, b, a2, b2); } else if(make_pair(a, b) < make_pair(a2, b2)){ sign = sign2; tie(a, b) = sub(a2, b2, a, b); } else{ tie(a, b) = sub(a, b, a2, b2); } } if(!sign) cout << '-'; cout << a << '.' << setfill('0') << setw(10) << b << endl; return 0; }