#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; bool compare(const long double a, const long double b) { return fabsl(a) < fabsl(b); } int main() { int n; cin >> n; vector a, b; int ans[100] = {0}, bbb[100] = {0}; for (int i = 0; i < n; i++) { string s; cin >> s; if (s[0] == '-') { b.push_back(s.substr(1)); }else { a.push_back(s); } } for (int i = 0; i < a.size(); i++) { bool ok = false; for (int j = 0; j < a[i].size(); j++) { if (a[i][j] == '.') { ok = true; string t = ""; for (int k = 0; k < 50-j; k++) t += "0"; a[i] = t+a[i].substr(0, j)+a[i].substr(j+1); int n = a[i].size(); for (int k = 0; k < 100-n; k++) a[i] += "0"; } } if (!ok) { int n = a[i].size(); string t = ""; for (int j = 0; j < 50-n; j++) t += "0"; a[i] = t+a[i]; n = a.size(); for (int j = 0; j < 100-n; j++) a[i] += "0"; } } for (int i = 0; i < b.size(); i++) { bool ok = false; for (int j = 0; j < b[i].size(); j++) { if (b[i][j] == '.') { ok = true; string t = ""; for (int k = 0; k < 50-j; k++) t += "0"; b[i] = t+b[i].substr(0, j)+b[i].substr(j+1); int n = b[i].size(); for (int k = 0; k < 100-n; k++) b[i] += "0"; } } if (!ok) { int n = b[i].size(); string t = ""; for (int j = 0; j < 50-n; j++) t += "0"; b[i] = t+b[i]; n = b.size(); for (int j = 0; j < 100-n; j++) b[i] += "0"; } } int c = 0; for (int i = 0; i < a.size(); i++) { c = 0; for (int j = 99; j >= 0; j--) { int t = ans[j]; ans[j] = (ans[j]+(a[i][j]-'0')+c)%10; c = (t+(a[i][j]-'0')+c)/10; } } for (int i = 0; i < b.size(); i++) { c = 0; for (int j = 99; j >= 0; j--) { int t = bbb[j]; bbb[j] = (bbb[j]+(b[i][j]-'0')+c)%10; c = (t+(b[i][j]-'0')+c)/10; } } int p; for (int i = 0; i < 99; i++) { if (ans[i] > 0) { p = i; break; } } // for (int i = 0; i < 100; i++) cout << ans[i]; // cout << endl; // for (int i = 0; i < 100; i++) cout << bbb[i]; // cout << endl; bool ok = false; for (int i = 0; i < 100; i++) { if (ans[i] < bbb[i]) { ok = true; }else if (ans[i] > bbb[i]) { break; } } if (ok) { for (int i = 0; i < 100; i++) { int t = ans[i]; ans[i] = bbb[i]; bbb[i] = t; } } bool minus = false; c = false; for (int i = 99; i >= 0; i--) { if (ans[i]-bbb[i]-c < 0) { if (i <= p) { minus = true; ans[i] = bbb[i]-(ans[i]-c); c = false; }else { ans[i] = 10-(bbb[i]-(ans[i]-c)); c = true; } }else { ans[i] = ans[i]-bbb[i]-c; c = false; } } int l, r; for (int i = 0; i < 100; i++) { if (ans[i] > 0) { l = i; break; } } for (int i = 100; i >= 0; i--) { if (ans[i] > 0) { r = i; break; } } if (!(minus && ok) && (minus || ok)) cout << "-"; if (l == 50) { cout << "0"; } for (int i = l; i <= r; i++) { if (i == 50) { cout << "." << ans[i]; }else { cout << ans[i]; } } if (r < 50) { for (int i = 0; i < 49-r; i++) cout << "0"; cout << "."; for (int i = 0; i < 10; i++) cout << "0"; }else { for (int i = 0; i < 10-((r+1)-50); i++) cout << "0"; } cout << endl; }