this unusual problem unusual contest announcement httpcodeforcescomblogentry73543you safe lock consist 5 decimal digit if rotate digit increase 9 0initially lock contain number x to unlock safe follow operation order careful do not mix statementsif sum digit position 3 4 great 10 rotate digit position 2 9 time rotate digit position 5 4 timesif digit position 3 great digit position 5 rotate digit position 2 4 time rotate digit position 4 6 timesif digit position 5 great digit position 3 rotate digit position 2 1 time rotate digit position 1 7 timesif sum digit position 4 1 great 8 rotate digit position 2 7 time rotate digit position 3 3 timesif digit position 4 great digit position 1 rotate digit position 2 3 time rotate digit position 3 2 timesif sum digit position 1 2 great 9 rotate digit position 3 6 time rotate digit position 5 3 timesif digit position 3 great digit position 2 rotate digit position 1 2 time rotate digit position 4 5 timesif digit position 5 great digit position 3 rotate digit position 2 1 time rotate digit position 4 5 timesif sum digit position 5 1 great 10 rotate digit position 4 7 time rotate digit position 3 5 timesif sum digit position 5 4 great 9 rotate digit position 3 9 time rotate digit position 2 4 timesif sum digit position 3 1 great 8 rotate digit position 2 8 time rotate digit position 4 4 timesif digit position 5 great digit position 2 rotate digit position 1 5 time rotate digit position 3 8 timesif sum digit position 1 4 great 10 rotate digit position 3 4 time rotate digit position 5 1 timesif digit position 3 great digit position 5 rotate digit position 2 1 time rotate digit position 1 6 timesif sum digit position 1 5 great 9 rotate digit position 3 3 time rotate digit position 2 1 timesif digit position 5 great digit position 1 rotate digit position 4 8 time rotate digit position 2 1 timesif digit position 4 great digit position 1 rotate digit position 3 4 time rotate digit position 5 4 timesif sum digit position 3 1 great 8 rotate digit position 5 3 time rotate digit position 2 6 timesif digit position 3 great digit position 4 rotate digit position 2 3 time rotate digit position 1 5 timesif digit position 5 great digit position 4 rotate digit position 2 7 time rotate digit position 3 8 timesif digit position 2 great digit position 4 rotate digit position 5 9 time rotate digit position 1 4 timesif sum digit position 3 5 great 10 rotate digit position 4 1 time rotate digit position 2 5 timesif digit position 4 great digit position 1 rotate digit position 3 9 time rotate digit position 2 9 timesif digit position 5 great digit position 3 rotate digit position 2 4 time rotate digit position 1 6 timesif sum digit position 3 4 great 9 rotate digit position 5 8 time rotate digit position 2 5 timesif sum digit position 3 4 great 10 rotate digit position 5 2 time rotate digit position 1 5 timesif sum digit position 5 4 great 9 rotate digit position 3 3 time rotate digit position 1 8 timesif digit position 5 great digit position 2 rotate digit position 1 4 time rotate digit position 3 8 timesif digit position 3 great digit position 1 rotate digit position 5 6 time rotate digit position 2 6 timesif digit position 4 great digit position 5 rotate digit position 1 6 time rotate digit position 3 1 timesif sum digit position 3 5 great 10 rotate digit position 2 5 time rotate digit position 1 7 timesif sum digit position 5 2 great 9 rotate digit position 4 9 time rotate digit position 3 5 timesif sum digit position 2 4 great 10 rotate digit position 3 1 time rotate digit position 1 2 timesif digit position 3 great digit position 4 rotate digit position 5 7 time rotate digit position 2 1 timesif digit position 2 great digit position 5 rotate digit position 1 6 time rotate digit position 4 2 timesif digit position 2 great digit position 1 rotate digit position 5 3 time rotate digit position 4 4 timesif digit position 5 great digit position 4 rotate digit position 3 9 time rotate digit position 1 9 timesif digit position 1 great digit position 5 rotate digit position 4 6 time rotate digit position 2 5 timesif sum digit position 1 5 great 10 rotate digit position 3 7 time rotate digit position 2 4 timesif sum digit position 2 1 great 9 rotate digit position 3 7 time rotate digit position 5 4 time