I can get cheap flights to Rimini which i dont want to see but it is the closest airport to San Marino.
Fly in early on Sunday stay in San Marino Sunday and Monday. Travel to Ravenna and spend Tuesday there back to Rimini on Wednesday afternoon for the flight home.
Enough time?