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

#define  all(x)        (x).begin(),(x).end()
#define  pb            push_back
#define  lb            lower_bound
#define  ub            upper_bound
#define  fi            first
#define  se            second
#define  pii           pair<int,int>
#define  fastIO        ios_base::sync_with_stdio(false); cin.tie(NULL);
#define  mp            make_pair
#define endl '\n'
#define int long long

typedef double db;
typedef long long ll;

const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
const int INF = 1e9;

void solve() {

	string s; cin >> s;
	reverse(all(s));
	for (int i = 0; i < (int)s.length(); i++) {
		if (s[i] == '6') s[i] = '9';
		else if (s[i] == '9') s[i] = '6';
	}
	cout << s;
}

signed main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	fastIO

	int t = 1;
	// cin >> t;

	for (int tt = 1; tt <= t; tt++) {
		solve();
	}
}
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<math.h>
#define ll long long
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s[0]==s[1]&&s[1]==s[2])
	cout<<"Won"<<endl;
	else
	{
		cout<<"Lost"<<endl;
	}
	
}
	
	