Invia SMS: The hidden mathematical logic of stories