title: Remainder 7 Large Numbers
signature: remainder7LargeNumbers :: String -> Integer
  remainder7LargeNumbers num = 
test_code: import Text.Printf
  import Control.Exception (catch, SomeException)
  import Data.Typeable
  import qualified Data.List as List
  import qualified Data.Map as Map
  import qualified Data.Set as Set
  
  -- SOLUTION CODE
  -- ============================================
  
  PLACEHOLDER_CODE_BODY
  
  -- TESTING CODE 
  -- ============================================
  validateSolution :: Integer -> Integer -> Bool
  validateSolution actual expected = do
      actual == expected
  
  
  driver :: String -> Integer -> String
  driver num expected = do
      if (validateSolution (PLACEHOLDER_FN_NAME num) expected)
          then "PASSED"
      else "FAILED"
  
  main = do
      printf "TEST-0...%s\n" (driver ("K") (6) )
  
      printf "TEST-1...%s\n" (driver ("850076") (3) )
  
      printf "TEST-2...%s\n" (driver ("00111") (6) )
  
      printf "TEST-3...%s\n" (driver ("X") (5) )
  
      printf "TEST-4...%s\n" (driver ("1") (1) )
  
      printf "TEST-5...%s\n" (driver ("10010001100") (1) )
  
      printf "TEST-6...%s\n" (driver (" pgPeLz") (0) )
  
      printf "TEST-7...%s\n" (driver ("53212456821275") (3) )
  
      printf "TEST-8...%s\n" (driver ("101") (3) )
  
      printf "TEST-9...%s\n" (driver ("V") (3) )
  
source_py: def remainder_7_large_numbers(num):
      series = [1, 3, 2, (- 1), (- 3), (- 2)]
      series_index = 0
      result = 0
      for i in range((len(num) - 1), (- 1), (- 1)):
          digit = (ord(num[i]) - 48)
          result += (digit * series[series_index])
          series_index = ((series_index + 1) % 6)
          result %= 7
      if (result < 0):
          result = ((result + 7) % 7)
      return result
source_cpp: int remainder_7_large_numbers(string num) {
    int series [ ] = {
      1, 3, 2, - 1, - 3, - 2 };
      int series_index = 0;
      int result = 0;
      for ( int i = num . size ( ) - 1;
      i >= 0;
      i -- ) {
        int digit = num [ i ] - '0';
        result += digit * series [ series_index ];
        series_index = ( series_index + 1 ) % 6;
        result %= 7;
      }
      if ( result < 0 ) result = ( result + 7 ) % 7;
      return result;
    }