using System.Xml.Serialization;
using System.Data.DataSetExtensions;
public static void Main()
string test = Program.CheckSum("1Z89R93R680003004").ToString();
public static char CheckSum(string waybill)
if (!waybill.Length.Equals(17)) return new char();
waybill = waybill.Substring(2, waybill.Length -2);
int sz = (waybill.Trim().Length);
char chold = char.Parse(waybill.Substring(cx, 1).ToUpper());
if(((int)chold) < 91 & (int)chold > 64)
char chnew = ((char)((int)chold -3).ToString()[1]);
waybill = (waybill.Substring(0, cx) + chnew + waybill.Substring(cx + 1, sz -(cx + 1)));
odd = odd + Convert.ToInt16(waybill[cx].ToString());
even = even + Convert.ToInt16(waybill[cx].ToString());
int retINT = 10 - (odd + even) % 10;
var s = (char)(retINT + 48);