#include <iostream>
using namespace std;
#define WRITE_LL_CLASS(T) \
class Node_ ## T { \
public: \
T data; \
Node_ ## T * next; \
Node_ ## T (T d, Node_ ## T * n) :data(d), next(n) { } \
\
T printAndSum() { \
cout << data << endl; \
if (next == NULL) return data; \
else return data + next->printAndSum(); \
} \
};
WRITE_LL_CLASS(float)
WRITE_LL_CLASS(int)
int main() {
Node_float* fhead = NULL;
Node_int* ihead = NULL;
float x;
while (cin >> x) {
fhead = new Node_float(x, fhead);
ihead = new Node_int((int)x, ihead);
}
cout << "Floating sum: " << fhead->printAndSum() << endl << endl;
cout << "Int sum: " << ihead->printAndSum() << endl << endl;
return 0;
}