PWhile -- Expected Cost Analysis

Input
or with a timeout of seconds.