using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace foryuki { class Program { static void Main(string[] args) { string N = Console.ReadLine(); string M = Console.ReadLine(); var n = int.Parse(N.Substring(N.Count() - 1, 1)); var m = int.Parse(M.Substring(N.Count() - 1, 1)); var ans = Math.Pow(n,m) % 10; Console.WriteLine(ans); Console.ReadLine(); } //------------------------------------------------------------- static int[] ConvertStringArrayToIntArray(string[] array) { return Array.ConvertAll(array, str => int.Parse(str)); } static List ConvertStringArrayToIntList(string[] str) { var list = new List(); foreach (var c in str) { list.Add(int.Parse(c)); } return list; } } }