Implement a Caesar cipher. Letters are shifted by a given amount, wrapping within the alphabet and preserving case; non-letter characters are left unchanged.
Input:
- Line 1: shift amount (integer, may be any sign) and mode (
encode or decode), space-separated
- Line 2: the text
Output: the transformed text on one line. Decoding with shift s reverses encoding with shift s.