~AUTUMN CODE WALK~


You encounter an intriguing binary file format. Your task is to parse its structure and extract relevant information.

The structure of the format is as follows: the first line contains the magic number that identifies the format. In hex notation, this is c5 c7 57. The next line specifies the number of referenced objects present in the file; call this number N. The next N lines are zero-padded positive integers (each has exactly 10 digits) specifying the absolute byte offsets at which the respective objects are defined. Each object's id is inferred from the order in which the offsets are enumerated, starting from 0. This part of the format is called the reference table. It may look like this:

3
0000002135
0000024352
0000099641

The remaining part of the document contains object definitions. An object in this format can have many forms. For the purpose of this task, we will define only a subset of them.

Objects come in two categories: atomic and composed. Atomic objects include:

Next, we will define two composed objects:

{
  "format" => "acw"
  "size" => 6539
  "content" => false
  "inner" => {"value" => 12}
}
[11; -22; []; nil]

For readability, whitespace may be used around objects or lexical tokens. In this format, a whitespace consists only of the line feed character and the space character.

Your task is to compute the fingerprint checksum for an instance of this format. Iterate through each object in the reference table, compute its fingerprint, and multiply it by the object's id. To compute the fingerprint, use the following pseudocode:

func fp(obj: object) -> integer:
  switch type(obj):
  case string:
    return len(obj)  // note that len("\"") == 1
  case integer:
    return abs(obj)  // absolute value
  case boolean:
    if obj:
      return 1
    else:
      return 0
  case nil:
    return 31
  case map:
    return sum(fp(key)*fp(value) for key, value in obj.pairs()) + 3
  case array:
    return sum(fp(o) for o in obj) + 1

The checksum is the sum of these products of the fingerprint and the object's id.

Input format

A Base64-encoded file containing the structure defined above.

Output format

The fingerprint checksum of the file.

Sample input

xcdXCjQKMDAwMDAwMDA1MQowMDAwMDAwMDU0CjAwMDAwMDAxNDQKMDAwMDAwMDE4MQoKMAoKewogICAgImtpbmQiID0+ICJyb29cdCIKICAgICJzaXplIiA9PiAxMTEKICAgICJjb250ZW50IiA9PiBmYWxzZQogICAgImVuY29kaW5nIiA9PiBuaWwKfQoKW3RydWU7IGZhbHNlOyB0cnVlOyB0cnVlOyB0cnVlOyAtMV0KCiJhY3ciCg==

Sample output

732

Your input