using System;using System.Linq;using System.Collections.Generic;classMagnitude{publicstaticintGreatest(int n){string st = n.ToString();return(int)int.Parse(string.Concat(st.OrderByDescending(c => c)));}publicstaticBooleanAllInt(List<object> ls){if(ls.Skip(1).All(r => r isint))returntrue;elsereturnfalse;}publicstatic List<object>SqrModulus(List<object> ls){Boolean b =AllInt(ls);if((b ==false)||(((string)ls[0]!="cart")&&((string)ls[0]!="polar")))returnnewList<object>{false,-1,1};int i =1;int s =0;if((string)ls[0]=="cart"){while(i < ls.Count()-1){
s +=(int)ls[i]*(int)ls[i]+(int)ls[i +1]*(int)ls[i +1];
i +=2;}}else{
i =1;
s =0;while(i < ls.Count()-1){
s +=(int)ls[i]*(int)ls[i];
i +=2;}}
List<object> x =newList<object>{true, s,Greatest(s)};return x;}}