#include using namespace std; #define FOR(i, n) for(int i = 0; i < (n); i++) #define MEM(a, x) memset(a, x, sizeof(a)) #define ALL(a) a.begin(), a.end() #define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) typedef long long ll; typedef pair P; int n; string f(string s) { int pos = -1; FOR(i, s.size()) { if (s[i] == '.') pos = i; } string t; if (pos == -1) t = string(11-(int)s.size(), '0') + s + string(10, '0'); else t = string(11-pos, '0') + s.substr(0, pos) + s.substr(pos+1) + string(10-(s.size()-pos-1), '0'); reverse(ALL(t)); return t; } string calc(string s, string t, int type) { string ret = string(21, '0'); if (type == 0) { int c = 0; FOR(i, 21) { int a = s[i]-'0', b = t[i]-'0', res = a+b+c; c = res/10; ret[i] = (char)('0'+(res%10)); } } else { reverse(ALL(s)); reverse(ALL(t)); bool minus = false; if (s < t) { swap(s, t); minus = true; } reverse(ALL(s)); reverse(ALL(t)); int c = 0; FOR(i, 21) { int a = s[i]-'0', b = t[i]-'0', res = a-b-c; if (res < 0) { c = 1; ret[i] = (char)('0'+(res+10)); } else { c = 0; ret[i] = (char)('0'+res); } } reverse(ALL(ret)); ret = ret.substr(0, 11) + "." + ret.substr(11); int p = 0; while (p < 20 && ret[p] == '0') p++; ret = ret.substr(min(10, p)); if (minus) ret = "-" + ret; } return ret; } int main(int argc, char const *argv[]) { ios_base::sync_with_stdio(false); cin >> n; vector plus, minus; FOR(i, n) { string s; cin >> s; if (s[0] == '-') minus.push_back(f(s.substr(1))); else plus.push_back(f(s)); } string x = string(21, '0'); FOR(i, plus.size()) { string ret = calc(x, plus[i], 0); x = ret; } string y = string(21, '0'); FOR(i, minus.size()) { string ret = calc(y, minus[i], 0); y = ret; } cout << calc(x, y, 1) << endl; return 0; }