Nathan's thief of Baghdad problem