using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace y1168 { class Program { static void Main(string[] args) { int num = int.Parse(Console.ReadLine()); int ans = num % 9; if(ans == 0) { ans = 9; } Console.WriteLine(ans); } } }