#include using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) typedef long long ull; void add(deque &S, deque A) { int mx = max(S.size(), A.size()) + 3; REP(i, S.size(), mx) S.push_front(0); REP(i, A.size(), mx) A.push_front(0); reverse(S.begin(), S.end()); reverse(A.begin(), A.end()); vector ret; int kuri = 0; rep(i, S.size()) { int now = kuri + S[i] + A[i]; if(now > 9) { kuri = now / 10; now -= 10; ret.push_back(now); } else { kuri = 0; ret.push_back(now); } } while(kuri > 0) { ret.push_back(kuri); kuri /= 10; } reverse(ret.begin(), ret.end()); deque RET; bool ok = 0; rep(i, ret.size()) { if(ret[i] != 0) { ok = 1; } if(ok) { RET.push_back(ret[i]); } } S = RET; } // true: minus bool sub(deque& S, deque A) { int mx = max(S.size(), A.size()) + 3; REP(i, S.size(), mx) S.push_front(0); REP(i, A.size(), mx) A.push_front(0); reverse(S.begin(), S.end()); reverse(A.begin(), A.end()); bool isABigger = 0; rep(i, S.size()) { if(S[i] > A[i]) { isABigger = 0; break; } else if(S[i] < A[i]) { isABigger = 1; break; } } swap(S, A); vector ret; int kuri = 0; rep(i, S.size()) { int now = S[i]-A[i]-kuri; if(now < 0) { kuri = 0; while(now < 0) now += 10, kuri ++; ret.push_back(now); } else { kuri = 0; ret.push_back(now); } } reverse(ret.begin(), ret.end()); deque RET; bool ok = 0; rep(i, ret.size()) { if(ret[i] != 0) { ok = 1; } if(ok) { RET.push_back(ret[i]); } } S = RET; return isABigger; } int main() { int N; cin >> N; bool inverse = 0; deque sum; rep(i, N) { long double d; cin >> d; long long D = (long long)(d*(1e10)); string s; stringstream ss; ss << D; ss >> s; bool mcheck = 0; if(s[0] == '-') { mcheck = 1; s = s.substr(1); } int const SZ = s.size(); deque a; rep(i, SZ) { a.push_back(s[i]-'0'); } if(inverse) mcheck ^= 1; if(mcheck) { inverse = sub(sum, a); } else add(sum, a); } int sz = sum.size(); bool zero = 1; if(inverse) cout << '-'; rep(i, sz-10) { zero = 0; cout << char('0'+sum[i]); } if(zero) cout << 0; cout << char('.'); REP(i, sz-10, sz) { cout << char('0'+sum[i]); } cout << endl; return 0; }