#include <iostream>
#include <set>

using namespace std;

int main() {
  set<int> valid;
  int s;
  cin >> s;
  while(valid.size() < 4) {
    s = s + (s/13) + 15;
    valid.insert(s%100);
  }
  int ret = 0;
  while(valid.size()) {
    int x;
    cin >> x;
    ret++;
    if(valid.count(x)) {
      cout << "You hit a wumpus!\n";
      valid.erase(x);
    }
    int dist = 100;
    for(auto out: valid) {
      dist = min(dist, abs(out/10-x/10) + abs(out%10-x%10));
    }
    if(dist != 100) cout << dist << "\n";
  }
  cout << "Your score is " << ret << " moves.\n";
}