front and back dp(338,978の該当)