added solution for automatic answer