var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', function (line) {
   console.log( line.split(" ").map(Number).reduce(function(x,y){return x+y;}) % 24)
});