





import re
import string

import numpy as np

import datasets


__lowerCamelCase			:	Optional[Any]					    =	"""
Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.
"""

__lowerCamelCase			:	List[Any]					    =	"""
Args:
    predictions: List of predicted texts.
    references: List of reference texts.
    regexes_to_ignore: List, defaults to None. Regex expressions of characters to
        ignore when calculating the exact matches. Note: these regexes are removed
        from the input data before the changes based on the options below (e.g. ignore_case,
        ignore_punctuation, ignore_numbers) are applied.
    ignore_case: Boolean, defaults to False. If true, turns everything
        to lowercase so that capitalization differences are ignored.
    ignore_punctuation: Boolean, defaults to False. If true, removes all punctuation before
        comparing predictions and references.
    ignore_numbers: Boolean, defaults to False. If true, removes all punctuation before
        comparing predictions and references.
Returns:
    exact_match: Dictionary containing exact_match rate. Possible values are between 0.0 and 100.0, inclusive.
Examples:
    >>> exact_match = datasets.load_metric(\"exact_match\")
    >>> refs = [\"the cat\", \"theater\", \"YELLING\", \"agent007\"]
    >>> preds = [\"cat?\", \"theater\", \"yelling\", \"agent\"]
    >>> results = exact_match.compute(references=refs, predictions=preds)
    >>> print(round(results[\"exact_match\"], 1))
    25.0

    >>> exact_match = datasets.load_metric(\"exact_match\")
    >>> refs = [\"the cat\", \"theater\", \"YELLING\", \"agent007\"]
    >>> preds = [\"cat?\", \"theater\", \"yelling\", \"agent\"]
    >>> results = exact_match.compute(references=refs, predictions=preds, regexes_to_ignore=[\"the \", \"yell\"], ignore_case=True, ignore_punctuation=True)
    >>> print(round(results[\"exact_match\"], 1))
    50.0


    >>> exact_match = datasets.load_metric(\"exact_match\")
    >>> refs = [\"the cat\", \"theater\", \"YELLING\", \"agent007\"]
    >>> preds = [\"cat?\", \"theater\", \"yelling\", \"agent\"]
    >>> results = exact_match.compute(references=refs, predictions=preds, regexes_to_ignore=[\"the \", \"yell\", \"YELL\"], ignore_case=True, ignore_punctuation=True)
    >>> print(round(results[\"exact_match\"], 1))
    75.0

    >>> exact_match = datasets.load_metric(\"exact_match\")
    >>> refs = [\"the cat\", \"theater\", \"YELLING\", \"agent007\"]
    >>> preds = [\"cat?\", \"theater\", \"yelling\", \"agent\"]
    >>> results = exact_match.compute(references=refs, predictions=preds, regexes_to_ignore=[\"the \", \"yell\", \"YELL\"], ignore_case=True, ignore_punctuation=True, ignore_numbers=True)
    >>> print(round(results[\"exact_match\"], 1))
    100.0

    >>> exact_match = datasets.load_metric(\"exact_match\")
    >>> refs = [\"The cat sat on the mat.\", \"Theaters are great.\", \"It's like comparing oranges and apples.\"]
    >>> preds = [\"The cat sat on the mat?\", \"Theaters are great.\", \"It's like comparing apples and oranges.\"]
    >>> results = exact_match.compute(references=refs, predictions=preds)
    >>> print(round(results[\"exact_match\"], 1))
    33.3

"""

__lowerCamelCase			:	Any					    =	"""
"""



@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION			,  _KWARGS_DESCRIPTION     )
class    A__  (			datasets.Metric     ):





      def 			__UpperCamelCase(					self  ):
       '''simple docstring'''




       return datasets.MetricInfo(
           description=_DESCRIPTION			,				citation=_CITATION			,				inputs_description=_KWARGS_DESCRIPTION			,				features=datasets.Features(
               {
                   "predictions": datasets.Value("string"			,				id="sequence"  ),
                   "references": datasets.Value("string"			,				id="sequence"  ),
               }  )			,				reference_urls=[]			,				)





      def 			__UpperCamelCase(					self			,				A_			,				A_			,				A_=None			,				A_=False			,				A_=False			,				A_=False			,				):
       '''simple docstring'''




       if regexes_to_ignore is not None:
        for s in regexes_to_ignore:
         UpperCamelCase      :   Optional[int]			      =  np.array([re.sub(A_			,				""			,				A_  ) for x in predictions]  )
         UpperCamelCase      :   Any			      =  np.array([re.sub(A_			,				""			,				A_  ) for x in references]  )
       else:
        UpperCamelCase      :   Union[str, Any]			      =  np.asarray(A_  )
        UpperCamelCase      :   Optional[int]			      =  np.asarray(A_  )

       if ignore_case:
        UpperCamelCase      :   Dict			      =  np.char.lower(A_  )
        UpperCamelCase      :   str			      =  np.char.lower(A_  )

       if ignore_punctuation:
        UpperCamelCase      :   int			      =  string.punctuation.maketrans(""			,				""			,				string.punctuation  )
        UpperCamelCase      :   Dict			      =  np.char.translate(A_			,				table=A_  )
        UpperCamelCase      :   List[Any]			      =  np.char.translate(A_			,				table=A_  )

       if ignore_numbers:
        UpperCamelCase      :   str			      =  string.digits.maketrans(""			,				""			,				string.digits  )
        UpperCamelCase      :   Any			      =  np.char.translate(A_			,				table=A_  )
        UpperCamelCase      :   Dict			      =  np.char.translate(A_			,				table=A_  )

       UpperCamelCase      :   List[str]			      =  predictions == references

       return {"exact_match": np.mean(A_  ) * 100}







import os



def 						A_							(	)		->					Union[str, Any]:
 with open(os.path.dirname(_lowerCAmelCase	) + "/grid.txt"	) as f:
  UpperCamelCase      :   Optional[Any]			      =  []  # noqa: E741
  for _ in range(20	):
   l.append([int(_lowerCAmelCase	) for x in f.readline().split()]	)

  UpperCamelCase      :   str			      =  0

  # right
  for i in range(20	):
   for j in range(17	):
    UpperCamelCase      :   int			      =  l[i][j] * l[i][j + 1] * l[i][j + 2] * l[i][j + 3]
    if temp > maximum:
     UpperCamelCase      :   List[Any]			      =  temp

        # down
  for i in range(17	):
   for j in range(20	):
    UpperCamelCase      :   List[str]			      =  l[i][j] * l[i + 1][j] * l[i + 2][j] * l[i + 3][j]
    if temp > maximum:
     UpperCamelCase      :   List[str]			      =  temp

        # diagonal 1
  for i in range(17	):
   for j in range(17	):
    UpperCamelCase      :   Any			      =  l[i][j] * l[i + 1][j + 1] * l[i + 2][j + 2] * l[i + 3][j + 3]
    if temp > maximum:
     UpperCamelCase      :   Tuple			      =  temp

        # diagonal 2
  for i in range(17	):
   for j in range(3				,  20	):
    UpperCamelCase      :   Tuple			      =  l[i][j] * l[i + 1][j - 1] * l[i + 2][j - 2] * l[i + 3][j - 3]
    if temp > maximum:
     UpperCamelCase      :   List[Any]			      =  temp
  return maximum


if __name__ == "__main__":
    print(solution())
