'use strict'
function main(input) {
  input = input.trim().replace(/(0+)/, '0').split('')
  if (input[input.length - 1] === '0') {
    console.log(Number(input.join('')))
  } else {
    console.log(input.reduce((r, c) => Number(r) + Number(c), 0))
  }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
