[ACM]Q374: Big Mod

[ACM]Q374: Big Mod

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;

namespace Q374
{
    class Program
    {
        static private BigInteger _b; static private bool _btof; static private BigInteger _p; static private bool _ptof;
        static private BigInteger _m; static private bool _mtof;static private BigInteger result;
        static void Main(string[] args)
        {
            for (; ; )
            {
            labelb: Console.Write("B>>>");
                _btof = BigInteger.TryParse(Console.ReadLine(), out _b);
                if (!_btof) goto labelb;
            labelp: Console.Write("P>>>");
                _ptof = BigInteger.TryParse(Console.ReadLine(), out _p);
                if (!_ptof) goto labelp;
            labelm: Console.Write("M>>>");
                _mtof = BigInteger.TryParse(Console.ReadLine(), out _m);
                if (!_mtof) goto labelm; result = 1;
                for (BigInteger i = 0; i < _p; i++)
                {
                    result *= _b;
                    if (result >= _m) result %= _m;
                }
                Console.WriteLine(result);
            }
        }
    }
}