#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, long long);
int /*<<< orphan*/ scanf(char *, int *);
int strlen(char *);
int main() {
  long long int multiplier[8] = {1,
                                 20,
                                 360,
                                 7200,
                                 7200 * 20,
                                 7200 * 20 * 20,
                                 7200 * 20 * 20 * 20,
                                 7200 * 20 * 20 * 20 * 20};
  char in[10000];
  int n;
  int i;
  int dash, dot;
  long long int ans;
  while (1) {
    ans = 0;
    scanf("%d", &n);
    if (n == 0)
      break;
    getchar();
    while (n--) {
      dash = dot = 0;
      gets(in);
      for (i = 0; i <= strlen(in); i++) {
        if (in[i] == '.')
          dot++;
        else if (in[i] == '-')
          dash++;
      }
      ans += (dot + (dash * 5)) * multiplier[n];
    }
    printf("%lld\n", ans);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2780,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xe83(%rip),%rsi
mov    $0x40,%edx
call   1060 <memcpy@plt>
movq   $0x0,-0x2778(%rbp)
lea    0xea7(%rip),%rdi
lea    -0x2764(%rbp),%rsi
call   1080 <scanf@plt>
cmpl   $0x0,-0x2764(%rbp)
jne    11b7 <main+0x57>
jmp    12e4 <main+0x184>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x2764(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x2764(%rbp)
cmp    $0x0,%eax
je     12cc <main+0x16c>
movl   $0x0,-0x2770(%rbp)
movl   $0x0,-0x276c(%rbp)
lea    -0x2760(%rbp),%rdi
call   1070 <gets@plt>
movl   $0x0,-0x2768(%rbp)
mov    -0x2768(%rbp),%eax
mov    %eax,-0x277c(%rbp)
lea    -0x2760(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x277c(%rbp),%eax
cmp    %ecx,%eax
jg     129b <main+0x13b>
movslq -0x2768(%rbp),%rax
movsbl -0x2760(%rbp,%rax,1),%eax
ff
cmp    $0x2e,%eax
jne    1256 <main+0xf6>
mov    -0x2770(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2770(%rbp)
jmp    1282 <main+0x122>
movslq -0x2768(%rbp),%rax
movsbl -0x2760(%rbp,%rax,1),%eax
ff
cmp    $0x2d,%eax
jne    127d <main+0x11d>
mov    -0x276c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x276c(%rbp)
jmp    1282 <main+0x122>
jmp    1287 <main+0x127>
mov    -0x2768(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2768(%rbp)
jmp    1202 <main+0xa2>
mov    -0x2770(%rbp),%eax
imul   $0x5,-0x276c(%rbp),%ecx
add    %ecx,%eax
cltq
movslq -0x2764(%rbp),%rcx
imul   -0x50(%rbp,%rcx,8),%rax
add    -0x2778(%rbp),%rax
mov    %rax,-0x2778(%rbp)
jmp    11be <main+0x5e>
mov    -0x2778(%rbp),%rsi
lea    0xd69(%rip),%rdi
call   1040 <printf@plt>
jmp    1187 <main+0x27>
xor    %eax,%eax
add    $0x2780,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2728,%rsp
lea    0xed8(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
je     125b <main+0x10b>
lea    0x10(%rsp),%rbx
lea    0xe77(%rip),%rbp
jmp    11be <main+0x6e>
nopl   0x0(%rax,%rax,1)
xor    %r13d,%r13d
lea    0xea9(%rip),%rdi
mov    %r13,%rsi
call   1040 <printf@plt>
lea    0xe97(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
je     125b <main+0x10b>
xor    %eax,%eax
call   1050 <getchar@plt>
subl   $0x1,0xc(%rsp)
jb     1190 <main+0x40>
xor    %r13d,%r13d
jmp    1206 <main+0xb6>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %r15d,%r15d
xor    %r14d,%r14d
lea    (%r15,%r15,4),%eax
add    %r14d,%eax
cltq
movslq 0xc(%rsp),%rcx
imul   0x0(%rbp,%rcx,8),%rax
add    %rax,%r13
sub    $0x1,%ecx
mov    %ecx,0xc(%rsp)
jb     1193 <main+0x43>
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
js     11e0 <main+0x90>
xor    %r14d,%r14d
mov    $0xffffffffffffffff,%r12
xor    %r15d,%r15d
jmp    1247 <main+0xf7>
nopl   0x0(%rax)
add    $0x1,%r15d
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
add    $0x1,%r12
cmp    %rax,%r12
jge    11e6 <main+0x96>
movzbl 0x11(%rsp,%r12,1),%eax
cmp    $0x2d,%al
je     1230 <main+0xe0>
cmp    $0x2e,%al
jne    1234 <main+0xe4>
add    $0x1,%r14d
jmp    1234 <main+0xe4>
xor    %eax,%eax
add    $0x2728,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.multiplier = [8 x i64] [i64 1, i64 20, i64 360, i64 7200, i64 144000, i64 2880000, i64 57600000, i64 1152000000]
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i64]
%3 = alloca [10000 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
store i32 0, i32* %1
%9 = bitcast [8 x i64]* %2 to i8*
br label %10
10: ; preds = %0, %67
store i64 0, i64* %8
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
br label %70
15: ; preds = %10
%16 = call i32 (...) @getchar()
br label %17
17: ; preds = %54, %15
%18 = load i32, i32* %4
%19 = add nsw i32 %18, -1
store i32 %19, i32* %4
%20 = icmp ne i32 %18, 0
br i1 %20, label %21, label %67
21: ; preds = %17
store i32 0, i32* %7
store i32 0, i32* %6
%22 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%23 = call i32 @gets(i8* %22)
store i32 0, i32* %5
br label %24
24: ; preds = %51, %21
%25 = load i32, i32* %5
%26 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%27 = call i32 @strlen(i8* %26)
%28 = icmp sle i32 %25, %27
br i1 %28, label %29, label %54
29: ; preds = %24
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 46
br i1 %35, label %36, label %39
36: ; preds = %29
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %50
39: ; preds = %29
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 45
br i1 %45, label %46, label %49
46: ; preds = %39
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %49
49: ; preds = %46, %39
br label %50
50: ; preds = %49, %36
br label %51
51: ; preds = %50
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %24
54: ; preds = %24
%55 = load i32, i32* %7
%56 = load i32, i32* %6
%57 = mul nsw i32 %56, 5
%58 = add nsw i32 %55, %57
%59 = sext i32 %58 to i64
%60 = load i32, i32* %4
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [8 x i64], [8 x i64]* %2, i64 0, i64 %61
%63 = load i64, i64* %62
%64 = mul nsw i64 %59, %63
%65 = load i64, i64* %8
%66 = add nsw i64 %65, %64
store i64 %66, i64* %8
br label %17
67: ; preds = %17
%68 = load i64, i64* %8
%69 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %68)
br label %10
70: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@__const.main.multiplier = [8 x i64] [i64 1, i64 20, i64 360, i64 7200, i64 144000, i64 2880000, i64 57600000, i64 1152000000]
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%lld\0A\00"
define i32 @main() {
%1 = alloca [10000 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %55, label %8
8: ; preds = %0, %49
%9 = call i32 (...) @getchar()
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
%12 = icmp eq i32 %10, 0
br i1 %12, label %49, label %13
13: ; preds = %8, %35
%14 = phi i64 [ %46, %35 ], [ 0, %8 ]
%15 = call i32 @gets(i8* %3)
%16 = call i32 @strlen(i8* %3)
%17 = icmp slt i32 %16, 0
br i1 %17, label %35, label %18
18: ; preds = %13, %28
%19 = phi i64 [ %31, %28 ], [ 0, %13 ]
%20 = phi i32 [ %30, %28 ], [ 0, %13 ]
%21 = phi i32 [ %29, %28 ], [ 0, %13 ]
%22 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 %19
%23 = load i8, i8* %22
switch i8 %23, label %28 [
i8 46, label %24
i8 45, label %26
]
24: ; preds = %18
%25 = add nsw i32 %20, 1
br label %28
26: ; preds = %18
%27 = add nsw i32 %21, 1
br label %28
28: ; preds = %18, %24, %26
%29 = phi i32 [ %21, %24 ], [ %27, %26 ], [ %21, %18 ]
%30 = phi i32 [ %25, %24 ], [ %20, %26 ], [ %20, %18 ]
%31 = add nuw nsw i64 %19, 1
%32 = call i32 @strlen(i8* %3)
%33 = sext i32 %32 to i64
%34 = icmp slt i64 %19, %33
br i1 %34, label %18, label %35
35: ; preds = %28, %13
%36 = phi i32 [ 0, %13 ], [ %29, %28 ]
%37 = phi i32 [ 0, %13 ], [ %30, %28 ]
%38 = mul nsw i32 %36, 5
%39 = add nsw i32 %37, %38
%40 = sext i32 %39 to i64
%41 = load i32, i32* %2
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [8 x i64], [8 x i64]* @__const.main.multiplier, i64 0, i64 %42
%44 = load i64, i64* %43
%45 = mul nsw i64 %44, %40
%46 = add nsw i64 %45, %14
%47 = add nsw i32 %41, -1
store i32 %47, i32* %2
%48 = icmp eq i32 %41, 0
br i1 %48, label %49, label %13
49: ; preds = %35, %8
%50 = phi i64 [ 0, %8 ], [ %46, %35 ]
%51 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %50)
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%53 = load i32, i32* %2
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %8
55: ; preds = %49, %0
ret i32 0
}