#include <iostream>
using namespace std;
int main() {
double sum = 0 , a_first, a_prev, a_cur;
cin >> a_first;
a_cur = a_first;
a_prev = a_first;
while (a_cur >= 0) {
cin >> a_cur;
if (a_cur < 0) {
sum += a_prev*a_first;
break;
}
sum += a_prev*a_cur;
a_prev = a_cur;
}
cout << "Sum = " << sum << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7Cglkb3VibGUgc3VtID0gMCAsIGFfZmlyc3QsIGFfcHJldiwgYV9jdXI7CgljaW4gPj4gYV9maXJzdDsKICAgIGFfY3VyID0gYV9maXJzdDsKICAgIGFfcHJldiA9IGFfZmlyc3Q7CiAgICAKCXdoaWxlIChhX2N1ciA+PSAwKSB7CgkJY2luID4+IGFfY3VyOwoJCWlmIChhX2N1ciA8IDApIHsKCQkJc3VtICs9IGFfcHJldiphX2ZpcnN0OwoJCQlicmVhazsKCQl9CgkJc3VtICs9IGFfcHJldiphX2N1cjsKCQlhX3ByZXYgPSBhX2N1cjsKCX0KCQoJY291dCA8PCAiU3VtID0gIiA8PCBzdW0gPDwgZW5kbDsKCQoJcmV0dXJuIDA7Cn0=