#include <queue>
#include <iostream>
using namespace std;
struct x{
    int xx;
    bool operator<(const x b) const{
        return xx<b.xx;
    }
};
struct y{
    int xx;
    bool operator<(const y b) const{
        return xx>b.xx;
    }
};
int main(){
    priority_queue<x> maxheap;
    priority_queue<y> minheap;
    x tempx;
    y tempy;
    int n = 0,k;
    while (cin >> k){
        ++n;
        if (n%2){
            tempx.xx =k;
            maxheap.push(tempx);
            tempy.xx = maxheap.top().xx;
            minheap.push(tempy);
            maxheap.pop();
            tempx.xx = minheap.top().xx;
            maxheap.push(tempx);
            minheap.pop();
            cout << maxheap.top().xx <<endl;
        } else {
            tempy.xx = k;
            minheap.push(tempy);
            tempx.xx = minheap.top().xx;
            maxheap.push(tempx);
            minheap.pop();
            tempy.xx = maxheap.top().xx;
            minheap.push(tempy);
            maxheap.pop();
            cout << (maxheap.top().xx+minheap.top().xx)/2 <<endl;
        }
    }
    return 0;
}
