# Hong Kong Identity card

## Question

The Hong Kong Identity Card consists of 1 English letter and 6 numeric digits. A check digit, which could be 0 to 9 or A, is appended in brackets. It is calculated as follows:

* For letters, A is converted to value 1, B to value 2, and so on.
* For every HKID number $$LD\_1D\_2D\_3D\_4D\_5D\_6$$, the sum is $$S= 8L + 7D\_1 + 6D\_2 + 5D\_3 +4D\_4 + 3D\_5 +2D\_6$$.
* The check digit c shall be the smallest non-negative integer such that $$(s + c)%11=0$$. If c is 10, A is used instead.

Write a program to determine if the Identity Card is valid.

### Input Format

A line which consists of the format $$LD\_1D\_2D\_3D\_4D\_5D\_6(c)$$.

### Constraints

$$
A \le L \le Z
$$

$$
0 \le D\_1,D\_2,...D\_6\le9
$$

$$
0 \le c \le 9, or\ c=A
$$

### Output Format

Output 'YES' if the card is valid, otherwise, output 'NO'.

### Sample Inputs:

{% tabs %}
{% tab title="Input 0" %}

#### Input

```
A123456(3)
```

#### Output

```
True
```

{% endtab %}

{% tab title="Input 1" %}

#### Input

```
C876300(0)
```

#### Output

```
false
```

{% endtab %}
{% endtabs %}

<details>

<summary>Solution — Trivial</summary>

just follow the steps, and make it as a warmup. The harder part is actually how to split the characters instead.

Here's the solution:

```python
user_in = list(input())
user_in[0] = ord(user_in[0].upper()) - ord('A') + 1
if user_in[8] == 'A':
    user_in[8] = 10

big_num = 8
sum = 0

for ins in range(7):
    sum += big_num * int(user_in[ins])
    big_num -= 1

if((sum + int(user_in[8])) % 11 == 0):
    print("yes")
else:
    print("no")
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://eaglepb2.gitbook.io/cpw/special/hong-kong-identity-card.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
