Ported problem1's python to c#