#include <bits/stdc++.h>
using namespace std;

#define sz(v) (int)(v).size()

const int segs[10] = {6,2,5,5,4,5,6,3,7,6};

signed main() {
    cin.tie(0)->sync_with_stdio(0);

    auto to_segs = [&](int tt) -> string {
        int s = tt % 60; tt /= 60;
        int m = tt % 60; tt /= 60;
        int h = tt;
        string ss = to_string(s); while (sz(ss) < 2) ss = string(1, '0') + ss;
        string mm = to_string(m); while (sz(mm) < 2) mm = string(1, '0') + mm;
        string hh = to_string(h); while (sz(hh) < 2) hh = string(1, '0') + hh;
        return hh + ":" + mm + ":" + ss;
    };

    auto count_segs = [&](const string& t) -> int {
        int a = 0;
        for (const char& c : t) {
            if (c != ':') {
                assert('0' <= c && c <= '9');
                a += segs[c-'0'];
            }
        }
        return a;
    };

    string t; cin >> t;
    int h = (t[0]-'0')*10 + (t[1]-'0');
    int m = (t[3]-'0')*10 + (t[4]-'0');
    int s = (t[6]-'0')*10 + (t[7]-'0');
    int tt = s + m * 60 + h * 60 * 60;

    int initial_segs = count_segs(t);
    for (;;) {
        --tt;
        if (tt < 0) tt += 24 * 60 * 60;
        string segs = to_segs(tt);
        if (count_segs(segs) == initial_segs) {
            cout << segs << '\n';
            return 0;
        }
    }

}
