jiahuimbzuai/CoQuIR huggingface dataset:
//  [java]

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String N = br.readLine();

			if (Integer.parseInt(N) % f(N) == 0) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			// System.out.println(f(N) + "," + Integer.parseInt(N));
		}
	}

	private static int f(String N) {
		char[] values = N.toCharArray();
		int count = 0;
		for (char value : values) {
			count += value - '0';
		}
		return count;
	}
}
//  [java]
import java.util.*;
import java.io.*;
 
public class Main {
    static boolean[][] used;
    static int[] ans;
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int tmp = n;
        int t = 0;
        while(tmp > 0){
            t += tmp % 10;
            tmp /= 10;
        }
        System.out.println(n % t == 0 ? "Yes" : "No");
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    } 
}
//  [java]
import java.util.Scanner;
class Main{
	public static void main(String[]$){
		int v=gInt();
		int m=(""+v).chars().map(i->i-'0').sum();
		System.out.println(v%m==0?"Yes":"No");
	}
	static Scanner s=new Scanner(System.in);
	static int gInt(){return Integer.parseInt(s.next());}
}
//  [java]
import java.util.*;
 
class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String N = sc.next();
    int n = Arrays.stream(N.split("")).mapToInt(Integer::parseInt).sum();
    System.out.println(Integer.parseInt(N)%n == 0 ? "Yes" : "No");
  }
}
//  [java]
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();

        System.out.println(solve(N) ? "Yes" : "No");

        sc.close();
    }

    static boolean solve(int N) {
        return N % String.valueOf(N).chars().map(ch -> ch - '0').sum() == 0;
    }
}
//  [cpp]
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    int nn=n,tot=0;
    while(nn)
    {
        tot=tot+nn%10;
        nn=nn/10;
    }
    if(n%tot==0)printf("Yes\n");
    else printf("No\n");
    return 0;
}
//  [cpp]

#include <cstdio>

int main(){
    int x;
    scanf("%d",&x);
    int a = x;
    int b = 0;
    while(a != 0){
        b = b + a % 10;
        a = (a - a % 10) / 10;
    }
    if(x % b == 0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}
//  [cpp]
#include <stdio.h>

int main (){
	int input;
	int temp=0;
	scanf ("%d",&input);
	int cek=input;
	while(input>0){
		temp+=input%10;
		input/=10;
	}
	//printf ("%d",temp);
	if(cek%temp==0){
		printf ("Yes\n");
	}else printf ("No\n");
}
//  [cpp]
#include<iostream> 
#include<iomanip> 
#include<vector> 
#include<map> 
#include<set> 
#include<algorithm> 
#include<numeric> 
#include<limits> 
#include<bitset> 
#include<functional> 
#include<type_traits> 
#include<queue> 
#include<stack> 
#include<array> 
#include<random> 
#include<utility> 
#include<cstdlib> 
#include<ctime>
#define INT_MAX 2147483647
#define _LIBCPP_DEBUG 0
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (n); ++i)	
using namespace std;



int max(int a,int b) {
	int max;
	if (a > b) max = a;
	else max = b;
	return max;
}
int min(int a, int b) {
	int min;
	if (a < b) min = a;
	else min = b;
	return min;
}


int main() {
	int n;
	cin >> n;
	int t = 0;
	int s = 0;
	bool a = false;

	rep(i, n + 1) {
		t = i;
		s = 0;
		rep(i, 9) {
			s += t % 10;
			t /= 10;
		}
	}
	if ((n % s) == 0) {
		a = true;
	}
	if (a) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N , N_, a ;
  cin>>N;
  N_=N;
  a=0;
  for(int i=0 ; i<N ; i++){
    int b ;
    b=N_%10;
    N_ = (N_-b)/10;
    a +=b;
  }
  if(N%a==0){
  cout<< "Yes" << endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
int main(){

    long long int a = 0,N,i;
    cin >> N;

    int n = N;
    for(i = 0; i < 100000000; i++) {
        a += n % 10;
        n /= 10;
    }

    

    if(N % a  == 0) {
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
    return 0;
}
//  [c]
#include<stdio.h>   
#include<string.h>   
int main()  
{  
    int n;
    int s=0,x;
    scanf("%d",&n);
    x=n;
    while(n)
    {
    	s+=n%10;
    	n/=10;
	}
	if(x%s==0)
	printf("Yes\n");
	else
	printf("No\n");
    return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>


int main (void){
    long number; 
    long b=0;
    long n;
    
    
    scanf("%ld",&number);
    n=number;
    
    while(number!=0){
    b = b + number % 10;
    number = number / 10;
  }

    if(n%b == 0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    
    return 0;
}
/*int main(void)
{
  
  int number;
  int digit = 0;
 
  
  printf("数値 = ");
  scanf("%d", &number);
 
  
  while(number!=0){
    number = number / 10;
    ++digit;
  }
 
  
  printf("桁数 = %d\n", digit);
 
  return 0;
}*/
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main(void){
	
	char a[10];

	int i;
	int c=0;
	scanf("%s", a);

	for (i = 0; a[i] != '\0'; i++){
		c += a[i]-'0';
	}
	int b = atoi(a);
	if (b % c == 0)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}
//  [c]
#include<stdio.h>
int main(){
  int n,x=0,i;
  scanf("%d",&n);
  for(i=n;i;i/=10)x+=i%10;
  printf(n%x?"No":"Yes");
}
//  [c]
#include<stdio.h>
int fx(int n){
  int a=0;
  for(;n>0;n=n/10){
    a=a+n%10;
  }
  return a;
}
int main()
{
  int N;
  scanf("%d",&N);
  if(N%fx(N)==0){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}
//  [c]
#include <stdio.h>
int main(void){
    int x, f=0, a, y;
    
    scanf("%d",&x);
    
    y=x;
    while(1){
        f+=y%10;
        y=y/10;
        if(y==0) break;
    }
    
    a=x%f;
    if(a==0) printf("Yes\n");
    else     printf("No\n");
    return 0;
}
//  [javascript]
// https://atcoder.jp/contests/abc080/tasks/abc080_b
"use strict";
function Main(input) {
  const X = Number(input);
  const sum = input.split("").reduce((acc, cur) => Number(acc) + Number(cur), 0);

  if (X % sum === 0) {
    console.log("Yes");
  } else {
    console.log("No");
  }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input){
  var X = Number(input);
  var f = 0;
  for(var i of input){
    f += Number(i);
  }
  if(X%f==0){
    console.log('Yes');
  }else{
    console.log('No');
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict'

function main(input) {
    const sum = input
        .split('')
        .map(v => ~~v)
        .reduce((a, b) => a + b)
    const ans = Number(input) % sum === 0 ? 'Yes' : 'No'
    console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
(function() {
    'use strict';

    var lines = [];
    require('readline').createInterface({
      input: process.stdin,
      output: process.stdout
    }).on('line', function(line) {
      lines.push(line);
    });
    process.stdin.on('end', function() {
      //lines.forEach(function(line) {
        //var tokens = line.split(' ').map(Number);
        //    console.log(tokens[0] + ' ' + tokens[1]);
      //}
      //)
      ;

    // ToDo start
      var inLines = lines[0].split(" ")

      var keta = (inLines+'').length
      var insum = 0;

      for (var i=0;i<keta;i++){
        insum+=parseInt((inLines+'')[i])
      }

      var amari = inLines % insum;
//      console.log(insum)
      if (amari == 0) {
          console.log("Yes")
      } else {
        console.log("No")
        
      }
      
//      console.log( Math.pow(parseInt(lines[0]),2) - parseInt(lines[1])  )
    // ToDo end

    });


})();
//  [javascript]
const fs = require('fs');
const stdin = fs.readFileSync('/dev/stdin', 'utf-8');
const lines = stdin.split("\n");

//const line = lines[0].split(" ");
const N = lines[0].trim();
const D = N.split('');

var sum = 0;
for(var i=0; i < D.length; ++i) {
  sum += Number(D[i]);
}
if(Number(N) % sum == 0) {
  console.log('Yes');
} else {
  console.log('No');
}
//  [javascript]
"use strict";
    
const main = arg => {
    const N   = arg.split("\n")[0];
    const sum = N.split("").map(n=>parseInt(n)).reduce((m,n)=>m+n);
    console.log(N % sum == 0 ? "Yes" : "No");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"fmt"
)

func findSumOfDigits(n int) int {
	sum := 0
	for n > 0 {
		sum += n % 10
		n = n / 10
	}
	return sum
}

func main() {
	var n int
	fmt.Scan(&n)
	sum := findSumOfDigits(n)
	if n%sum == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n int

	fmt.Scan(&n)

	fx := 0
	temp := n
	for temp > 0 {
		fx += temp % 10
		temp /= 10
	}

	if n%fx == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [go]
package main

import "fmt"

func main() {
	var x int64
	fmt.Scanf("%d", &x)
	fx := getDigitSum(x)

	if x%fx == 0 {
		fmt.Printf("Yes")
	} else {
		fmt.Printf("No")
	}

}

func getDigitSum(n int64) int64 {
	var total int64
	for n > 0 {
		total += n % 10
		n /= 10
	}
	return total
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	X := ReadInt()
	fx := 0
	x := X
	for x > 0 {
		fx += x % 10
		x /= 10
	}
	if X%fx == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	m := n
	x := 0
	for m != 0 {
		x += m % 10
		m /= 10
	}
	if n%x == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}
//  [ruby]
def digit_sum(n, sum = 0)
    s = sum + n % 10
    i = n.div(10)
    i > 0 ? digit_sum(i, s) : s
end
N = gets.to_i
puts N % digit_sum(N) == 0 ? 'Yes' : 'No'
//  [ruby]
n = gets.to_i

sum = n.to_s.split('').map(&:to_i).inject(:+)
puts n % sum == 0 ? 'Yes' : 'No'
//  [ruby]
n = gets.chomp
puts (n.to_i % n.chars.map(&:to_i).inject(:+) == 0)? "Yes" : "No"
//  [ruby]
n = gets.chomp
tmp = n.to_i
fx = n.split("").map(&:to_i).inject(:+)
puts tmp % fx == 0 ? "Yes" : "No"
//  [ruby]
#メソッドの変換に注意！
n = gets.to_s
ary = n.chars.map(&:to_i)
s = ary.sum
if n.to_i%s==0
  puts "Yes"
else
  puts "No"
end
//  [ruby]
n = gets.chomp
len = n.length
fx = 0
len.times do |i|
  fx += n[i].to_i
end
if n.to_i % fx == 0
  puts "Yes"
else
  puts "No"
end
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: i64 = read();

    let mut x: i64 = 0;
    let mut mutn: i64 = n;

    while mutn > 0 {
        x += mutn % 10;
        mutn /= 10;
    }

    if n % x == 0 {
        println!("Yes")
    } else {
        println!("No")
    }
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

pub fn keta_sum(mut n: u64) -> u64 {
    let mut sum = 0;
    let d = 10;
    while n != 0 {
        sum += n % d;
        n /= d;
    }
    sum
}

fn main() {
    input! {
        n: u64
    }
    println!("{}", if n % keta_sum(n) == 0 {"Yes"} else {"No"});
}
//  [rust]
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		n: usize,
	}

	let mut m = n;
	let mut sum = 0;
	while m > 0 {
		sum += m % 10;
		m /= 10;
	}
	if n % sum == 0 {
		println!("Yes");
	}
	else {
		println!("No");
	}
}
//  [rust]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let n = get!(i32);
    let mut m = n;
    let mut h = 0;
    while m != 0 {
        h += m % 10;
        m /= 10;
    }
    println!("{}", if n % h == 0 { "Yes" } else { "No" });
}
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/

//var min, min2, count: Int!
//for i in 1...10 {
//    let x = Int(readLine()!)!
//    if i == 1 {
//        min = x
//        count = 1
//    } else if x < min {
//        min2 = min
//        min = x
//        count = 1
//    } else if x == min && count == 1 {
//        min2 = x
//        count = 2
//    }
//}
//print(min2)

/*************** メインプログラム ***************/

let input = readLine()!
let N = Int(input)!
let sum = input.toArray().reduce(0){$0+Int($1)!}
print(N % sum == 0 ? "Yes" : "No")
//  [swift]
func sumDigits(_ num: Int) -> Int {
    var sum = 0
    var num = num
    while num > 0 {
        sum += num%10
        num /= 10
    }
    return sum
}

func checkHash(_ num: Int) -> Void {
    if num % sumDigits(num) == 0 {
        print("Yes")
    } else {
        print("No")
    }
}
let a = Int(readLine()!)!
checkHash(a)
//  [swift]
//
//  main.swift
//  AtCoderSwift
//
//  Created by burita083 on 2020/08/25.
//  Copyright © 2020 burita083. All rights reserved.
//

import Foundation
func readInt() -> Int {
    return Int(readLine()!)!
}
 
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}
 
func readTwoInts() -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: " ").map { Int($0)! }
    return (a: ints[0], b: ints[1])
}


func abc080_b() {
    let N = readLine()!
    let sum = N.map { Int(String($0))! }.reduce(0, +)
    print(Int(N)! % sum == 0 ? "Yes" : "No")
}

abc080_b()
//  [swift]
import Foundation

let n = Int(readLine()!)!
let sum = String(n).map { Int(String($0))! }.reduce(0) { $0 + $1 }
print(n % sum == 0 ? "Yes" : "No")
//  [typescript]
import * as fs from "fs";

let input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const s = input[0];
const n = +s;

let fx = 0;
for (const c of s) {
	fx += +c;
}

console.log((n % fx === 0) ? "Yes" : "No");
//  [typescript]
const log = console.log;

const createDigitArray = (v: number, capacity: number, base = 10) => {
  const array = new Array<number>(capacity);

  for (let i = 0; i < capacity; i += 1) {
    if (v === 0) break;
    array[i] = v % base;
    v = (v / base) | 0;
  }

  return array;
};

const sumReducer = (accumulator: number, currentValue: number) =>
  accumulator + currentValue;
const sum = (numbers: number[]) => numbers.reduce(sumReducer, 0);

// ----

function Main(input: string): void {
  const n = +input;

  log(n % sum(createDigitArray(n, 10, 10)) === 0 ? "Yes" : "No");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10));
   let xs1 = input.trim().split('').map(v=>parseInt(v,10));
   let x =0;
   for(let i=0; i<xs1.length; i++){
   x += xs1[i];
   }
   if(xs[0]%x==0){
     console.log('Yes');
   }else{
     console.log('No');
   }
  }
Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = Number(input[0][0]);

  const digitSum = Number(
    N.toString()
      .split("")
      .map(Number)
      .reduce((sum, cur) => sum + cur)
  );

  return N % digitSum === 0 ? "Yes" : "No";
};

console.log(main(read()));
//  [typescript]
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8').trim()

const n = Number(stdin.split('\n')[0])

const ans = () => {
  const sum = String(n)
    .split('')
    .map(Number)
    .reduce((p, c) => p + c)

  console.log(n % sum === 0 ? 'Yes' : 'No')
}

ans()
//  [python]
import numpy as np
S = input()
count = 0
for i in np.arange(0, len(S), 2):
    if S[i] == "L":
        count += 1
        
for i in np.arange(1, len(S), 2):
    if S[i] == "R":
        count += 1

if count == 0:
    print("Yes")
else:
    print("No")
//  [python]
import numpy as np
S = input()
count = True
for i in np.arange(0, len(S), 2):
    if S[i] == "L":
        count = False
        
for i in np.arange(1, len(S), 2):
    if S[i] == "R":
        count = False

if count:
    print("Yes")
else:
    print("No")
//  [python]
import numpy as np
step = input()
step = list(step)
a = 0


for i, j in enumerate(step):
  if (i+1)%2 == 0 and j == "R":
    a += 1
    print("No")
    break
  elif (i+1)%2 == 1 and j=="L":
    a +=1
    print("No")
    break

if a == 0:
  print("Yes")
//  [c]
#include <stdio.h>
#include <string.h>

int main(){
  char S[102];
  scanf("%s",S);
  int N=strlen(S);
  int c=1;
  for(int i=0;i<N;i++){
    if(i%2==0){
      if(S[i]=='L'){
        c=0;
      }
    }else{
      if(S[i]=='R'){
        c=0;
      }
    }
  }
  if(c) printf("Yes\n");
  else printf("No\n");
    
  return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>
int main()
{
	char s[100];
	int a,i,x=0,y=0;
	scanf("%s",s);
	a=strlen(s);
	for(i=0;i<a;i++){
		if(i%2==0){
			if(s[i]=='L') x=1;
		}
		else{
			if(s[i]=='R') y=1;
		}
	}
	if(x==1||y==1) printf("No\n");
	else printf("Yes\n");
	return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
int main(void){
    char s[1000];
    int n, i;
    
    scanf("%s",s);
    n=strlen(s);
    
    int a=0;
    int b=0;
    for(i=0;i<n;i++){
        if(((i+1)%2)!=0){
            if((s[i]!='R')&&(s[i]!='U')&&(s[i]!='D')){
                a=1;
                break;
            }
        }
        else{
            if((s[i]!='L')&&(s[i]!='U')&&(s[i]!='D')){
                b=1;
                break;
            }
        }
    }
    if((a==0)&&(b==0)) printf("Yes\n");
    else printf("No\n");
    return 0;
}
//  [javascript]
function myout(text){console.log(text);}//standard output
function Main(input) {
	input = input.trim();
	//input = parseInt(input.trim());
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var good1 = ["R","U","D"];
  var good2 = ["L","U","D"];
  for(var i = 0; i < input.length; i++){
    var tmp = input.slice(i,i+1);
    if(i % 2 == 0){//奇数番目
       if(good1.indexOf(tmp) == -1){
          myout("No");
         return;
          }
       }else{
         if(good2.indexOf(tmp) == -1){
            myout("No");
         return;
            }
       }
  }
  myout("Yes");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
const main = (input) => {
  var s = input[0];
  var ans = true;
  s.split("").forEach((v,i)=>{
    if(i%2==0){
      if(['R', 'U', 'D'].indexOf(v) == -1) ans = false;
    }else{
      if(['L', 'U', 'D'].indexOf(v) == -1) ans = false;
    }
  })
  console.log(ans?"Yes":"No");
}
main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));
//  [javascript]
function Main(input) {
  "use strict"
  const temp = input.split("\n");

  const s = temp.shift().split("");
  const filter = s.filter((e,i) => {
    if(i % 2 === 0) return e === "L";
    else return e === "R"
  })

  if(filter.length === 0) console.log("Yes");
  else console.log("No");

}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main
 
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)
 
func run(){
	n := next()
	
	for i, v := range n {
		if(i%2 != 0){
			if(string(v) == "R"){
				Println("No")
				return
			}
		}else{
			if(string(v) == "L"){
				Println("No")
				return
			}
		}
	}
	Println("Yes")
	
}
 
 
// --- template ---
// Thanks https://gist.github.com/halllllll/853ab587fd82ee3ffe6f7fb7fb499695
 
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
 
// Caution: You will get unexpected result if a single token is larger than this size.
const BufferSize = 64 * 1024 * 1024
 
func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, a...)
}

func readIntArray(n int) ([]int) {
	v := make([]int, 0)
	for i := 0; i < n; i++ {
		v = append(v, nextInt())
	}
	return v
}
 
func Printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, format, a...)
}
 
func Println(a ...interface{}) (n int, err error) {
	return fmt.Fprintln(out, a...)
}
 
func next() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int {
	a, err := strconv.Atoi(next())
	if err != nil {
		log.Fatal(err)
	}
	return a
}
 
func nextFloat() float64 {
	a, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}
 
func main() {
	sc.Buffer(make([]byte, 0, BufferSize), BufferSize)
	sc.Split(bufio.ScanWords)
	run()
	out.Flush()
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	s := getString()
	flg := true

	for i := 0; i < len(s); i++ {
		x := s[i]
		if i%2 == 0 {
			if x == 'L' {
				flg = false
			}
		} else {
			if x == 'R' {
				flg = false
			}
		}
	}
	if flg {
		out("Yes")
		return
	}
	out("No")
}
//  [ruby]
#!/usr/bin/env ruby

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

S = gets.chomp

odds = ['R', 'U', 'D']
evens = ['L', 'U', 'D']

ans = true
S.split('').each.with_index do |s, i|
  n = i + 1
  target = n % 2 == 0 ? evens : odds
  unless target.include?(s)
    ans = false
    break
  end
end

puts ans ? 'Yes' : 'No'
//  [ruby]
s=gets.chomp
for i in 0..s.size-1
  if s[i]=="L" && i%2==0
    dame=1
  elsif s[i]=="R"&& i%2==1
    dame=1
  end
end
puts dame==1? :No: :Yes
//  [ruby]
s=gets
puts (0...s.size).any?{s[_1]=="LR"[_1%2]} ? :No : :Yes
//  [rust]
#[allow(unused_imports)]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(s: String);
    let v: Vec<char> = s.chars().collect();

    for i in 0..s.len() {
        if i % 2 == 0 {
            if v[i] == 'L' {
                println!("{}", "No");
                return;
            }
        } else {
            if v[i] == 'R' {
                println!("{}", "No");
                return;
            }
        }
    }
    println!("{}", "Yes");
}
//  [rust]
use proconio::marker::Chars;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {s: Chars};
    let s: Vec<char> = s;

    let v1 = vec!['R', 'U', 'D'];
    let v2 = vec!['L', 'U', 'D'];
    let mut flag = true;

    for (i, si) in s.iter().enumerate() {
        if (i + 1) % 2 == 0 {
            if !v2.contains(si) {
                flag = false;
            };
        } else {
            if !v1.contains(si) {
                flag = false;
            };
        }
    }

    if flag {
        println!("Yes")
    } else {
        println!("No")
    }
}
//  [rust]
fn main() {
    use std::collections::HashSet;

    let s: String = read_line_as_value();
    let mut odd_chars = HashSet::new();
    odd_chars.insert('R');
    odd_chars.insert('U');
    odd_chars.insert('D');
    let mut even_chars = HashSet::new();
    even_chars.insert('L');
    even_chars.insert('U');
    even_chars.insert('D');

    let mut ans = true;
    for (i, c) in s.chars().enumerate() {
        if (i+1) % 2 == 0 && even_chars.contains(&c) {
            continue
        } else if (i+1) % 2 == 1 && odd_chars.contains(&c) {
            continue
        } else {
            ans = false;
            break
        }
    }
    match ans {
        true => println!("Yes"),
        false => println!("No"),
    }
}

fn read_line_as_value<T: std::str::FromStr>() -> T {
    let mut input = String::new();
    let res = std::io::stdin().read_line(&mut input);
    if let Err(error) = res {
        panic!("io error at stdin.read_line: {}", error);
    };
    match input.trim().parse() {
        Ok(val) => val,
        _ => panic!("error while parsing input: {}", input)
    }
}
//  [swift]
let s=Array(readLine()!.characters)

var i = 0
var fuminikui = 0
for i in 1...s.count {
  if( ( i % 2 ) == 1 ) {
    if( s[i-1] == "L" ) {
      fuminikui = 1
    }
  } else if ( s[i-1] == "R" ) {
    fuminikui = 1
  }
}

if ( fuminikui == 1 ) {
  print( "No" )
} else {
  print( "Yes" )
}
//  [swift]
let s = readLine()!

let a = Array(s.characters)
let evens: [Character] = ["R", "U", "D"]
let odds: [Character] = ["L", "U", "D"] 
var i = 0
var good = true

while i < a.count {
  if !evens.contains(a[i]) {
    good = false
    print("No")
    break
  }
  i += 2
}

i = 1 

while i < a.count && good {
  if !odds.contains(a[i]) {
    good = false
    print("No")
    break
  }
  i += 2
}

if good {
  print("Yes")
}
//  [swift]
var ans="Yes"
for(i,c)in readLine()!.characters.enumerate(){
  if i%2==0&&c=="L"||i%2>0&&c=="R"{
    ans="No"
  }
}
print(ans)
//  [typescript]
import { createInterface } from 'readline';

const main = (lines: string[]) => {
  console.log(solve(lines));
};

export const solve = (lines: string[]): string => {
  const S = parseLines(lines);

  return S.split('').every(
    (e, i) => (i % 2 === 0 && e !== 'L') || (i % 2 === 1 && e !== 'R')
  )
    ? 'Yes'
    : 'No';
};

const parseLines = (lines: string[]) => {
  const obj = lines[0];
  debug(obj);
  return obj;
};

const debug = (message?: any, ...optionalParams: any[]) => {
  if (!!process.env.LOCAL_DEBUG) {
    console.log(message, ...optionalParams);
  }
};

if (!process.env.LOCAL_DEBUG) {
  const { stdin: input, stdout: output } = process;
  input.resume();
  input.setEncoding('utf8');
  const lines: string[] = [];
  createInterface({ input, output })
    .on('line', line => lines.push(line))
    .on('close', () => main(lines));
}
//  [typescript]
import { readFileSync } from 'fs'
function main() {
  const input = readFileSync('/dev/stdin', 'utf8')
  const s = input.trim().split('')
  const oddString = 'RUD'
  const evenString = 'LUD'
  let judge = 'Yes'
  for (let i = 0; i < s.length; i++) {
    if ((i + 1) % 2 === 0) {
      if (evenString.match(s[i]) === null) {
        judge = 'No'
        break
      }
    } else {
      if (oddString.match(s[i]) === null) {
        judge = 'No'
        break 
      }     
    }
  }
  console.log(judge)
}
main()
//  [typescript]
import * as fs from 'fs';

const main = (inp: string) => {
    let ans: string = 'Yes';
    for (let i: number = 0; i < inp.length; i++) {
        if ((i + 1) % 2 === 1) {
            // only R U D
            if (inp[i] === 'L') {
                ans = 'No';
                break;
            }
        } else {
            // only L U D
            if (inp[i] === 'R') {
                ans = 'No';
                break;
            }
        }
    }
    console.log(ans);
};

main(fs.readFileSync('/dev/stdin', 'utf8').trim());
//  [python]
A, B, H, M=map(int,input().split())
import numpy as np


if M==0 or M==60:
    m_deg = 0
else:
    m_deg = (M/60) *360

h_deg = (H/12)*360 +(M/60)*30

theta_deg = max(m_deg, h_deg) - min(m_deg, h_deg)
theta_rad = theta_deg*np.pi/180

cos_theta = np.cos(theta_rad)

C_2 = A**2 + B**2 - 2*B*A*cos_theta

print(C_2**0.5)
//  [python]
a,b,h,m=map(int,input().split())
import numpy as np
theta = ((h+m/60)/12 - m/60)*2*np.pi
c=a**2+b**2-2*a*b*np.cos(theta)
print(np.sqrt(c))
//  [python]
a, b, h, m = map(int, input().split())

import math
import numpy as np

hi = (360/12*h) + (360/12/60*m)
mi = 360/60*m
kakudo = 0
if abs(hi-mi) >= 180:
  kakudo = 360 - abs(hi-mi)
else:
  kakudo = abs(hi-mi)

c2 = a**2 + b**2 - 2*a*b*math.cos(math.radians(kakudo))
c = np.sqrt(c2)
print(c)
//  [java]
import java.util.*;
public class Main {
     public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int H = sc.nextInt();
        int M = sc.nextInt();

        double HR = 30 * H + M * 0.5;
        double MR = 360 / 60 * M;

        double r = Math.abs(HR - MR);
        double cos = Math.cos(Math.toRadians(r));
        double result = Math.pow(A, 2) + Math.pow(B, 2) - 2 * A * B * cos;
        result = Math.sqrt(result);
       
       
        System.out.println(result);
    }
}
//  [java]
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		double a = sc.nextDouble();
        double b = sc.nextDouble();
        double h = sc.nextDouble();
        double m = sc.nextDouble();
		double ans = 0;
        double H = Math.toRadians(90-30*h-m/2);
        double M = Math.toRadians(90-6*m);
        double x1 = a*Math.cos(H);
        double y1 = a*Math.sin(H);
        double x2 = b*Math.cos(M);
        double y2 = b*Math.sin(M);
        ans = Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
		System.out.println(ans);
	}
}
//  [java]
import java.util.*;
import javax.lang.model.util.ElementScanner6;
import java.lang.Math;

public class Main {

    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);

        // 入力
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int m = sc.nextInt();
        //String s = sc.next();

        // 処理
        //時針(0-11)
        double ao = 2*Math.PI / (12 * 60);
        double ax = a * (Math.sin((h * 60 + m) * ao));
        double ay = a * (Math.cos((h * 60 + m) * ao));;

        //分針(0-59)
        double bx = b * (Math.sin(2*Math.PI * m / 60));
        double by = b * (Math.cos(2*Math.PI * m / 60));;

        //距離
        double out = Math.sqrt(Math.pow(ax - bx, 2) + Math.pow(ay - by, 2));

        // 出力
        System.out.println(out);
    }
}
//  [cpp]
#include <bits/stdc++.h>
#include <algorithm>  
#include <unordered_set>
#define _USE_MATH_DEFINES
#include <cmath>
#define ll long long

using namespace std;

const double pi = 3.14159265358979323846;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int A, B, H, M;

	cin >> A >> B >> H >> M;


	double hours = ((double)(M)) / (60.0) + H;

	double hourHandDegree = hours / (12.0) * 360;

	double minHandDegree = hours / (1.0) * 360;


	double angle = hourHandDegree > minHandDegree ? hourHandDegree - minHandDegree : minHandDegree - hourHandDegree;

	//angle = angle / 360;
	angle = angle * pi / (180.0);


	double c = sqrt(A * A + B * B - 2 * A * B * cos(angle));

	cout << std::setprecision(10000000) << c << endl;




	return 0;
}
//  [c]
/* kadai4_2
   nabe9393 */

#include<stdio.h>
#include<math.h>

int main(void){
  //短針、長針、時、分、針の角度、答え
  double short_hand, long_hand, hour, minute, angle, answer;
  scanf("%lf %lf %lf %lf", &short_hand, &long_hand, &hour, &minute);
  //M_PIは元から定義されている
  //短針は1時間で３０度進み、1分で0.5度進む。
  //長針は1分で６度進む。
  angle = M_PI * (hour * 30.0 + minute / 2.0 - minute * 6.0) / 180.0 ;
  //cos(θ)=-cos(θ)より、角度の正負は考えない。
  //余弦定理を利用。
  answer = sqrt( pow(long_hand, 2) + pow(short_hand, 2) - 2 * long_hand * short_hand * cos(angle));
  printf("%.10lf\n", answer);
  return 0;
}
//  [c]
/* ex4_2 melo */
#include <stdio.h>
#include <math.h>//数学関数のヘッダーファイルを読み込む
#define PI 3.141592653589793238//円周率PIを十分な長さ定義する
int main(void){
    int lenN,lenM,hour,min;//整数の箱を四つ用意する
    double angleN,angleM,angleN_M,lenN_M;//倍精度の実数の箱を四つ用意する
    scanf("%d%d%d%d",&lenN,&lenM,&hour,&min);//
    angleN=(2*PI/12)*hour+(2*PI/720)*min;//
    angleM=(2*PI/60)*min;//
    angleN_M=angleN-angleM;
    lenN_M=sqrt(lenN*lenN+lenM*lenM-2*lenN*lenM*cos(angleN_M));//
    printf("%.18lf\n",lenN_M);//
    return 0;
}
//  [c]
#include<stdio.h>
#include<math.h>
#define pi acos(-1.0)
int main()
{
    int a,b,h,m;
    double k,l;
    scanf("%d%d%d%d",&a,&b,&h,&m);
    k =((30.0*h)+(m/12.0)*6.0-m*6.0)*pi/180;
    l=sqrt(a*a+b*b-2*a*b*cos(k));
    printf("%0.20lf",l);

    return 0;
}
//  [javascript]
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
 var abhm = lines[0].split(' ');
 var a = Number(abhm[0]);
 var b = Number(abhm[1]);
 var h = Number(abhm[2]);
 var m = Number(abhm[3]);

 var hkaku = h * 30 + m * 0.5;
 var mkaku = m * 6;
 var kaku = Math.abs(hkaku-mkaku);
 var kaku2 = 360 - Math.abs(hkaku-mkaku);
 kaku = Math.min(kaku2,kaku);
 kaku = Math.cos(kaku*(Math.PI/180));

 var ans = (a*a) + (b*b) - (2*a*b*kaku);
 console.log(Math.sqrt(ans));
});
//  [javascript]
process.stdin.setEncoding("utf8");
process.stdin.on("data", input => {
  // 3 4 9 0
  const inputArr = input.split(" ");
  const A = inputArr[0];
  const B = inputArr[1];
  const H = inputArr[2];
  const M = inputArr[3];
  const result = getResult(A, B, H, M);
  console.log(result);
});

const getResult = (A, B, H, M) => {
  const minuteDegree = (Math.PI * 2.0 * M) / 60;
  const hourDegree = Math.PI * 2 * (H / 12 + M / 60 / 12);
  const theta = minuteDegree - hourDegree;
  
  return calcCosinTheorem(A, B, theta);
};

const calcCosinTheorem = (A, B, theta) => {
  return Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(theta));
};
//  [javascript]
function main(input){
    // 文字列から10進数に変換する　 スペースきたら区切ってそれぞれリストにいれる
    var A = parseInt(input.split(" ")[0], 10);
    var B = parseInt(input.split(" ")[1], 10);
    var H = parseInt(input.split(" ")[2], 10);
    var M = parseInt(input.split(" ")[3], 10);
 
	// 時針のrad　jsはモジュールや定義なしでπ使える
	rad_H = ((360/12) * H + ((360/12)/60)*M) * (Math.PI/180);
	// 分針のrad
	rad_M = (360/60)*M*(Math.PI/180);
 
	// 針間の距離
	console.log(Math.sqrt( (A*A)+(B*B)-2*A*B*Math.cos(rad_H-rad_M)) );
}
 
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	var a, b, h, m int
	fmt.Scanf("%d %d %d %d", &a, &b, &h, &m)
	answer := colon(float64(a), float64(b), float64(h), float64(m))
	fmt.Println(answer)
}

func colon(a, b, h, m float64) float64 {
	angleM := 6.0 * m
	angleH := 30.0*h + 0.5*m
	angleMH := abs(angleH - angleM)
	radian := angleMH * math.Pi / 180.0
	x := abs(b - (math.Cos(radian) * a))
	y := abs(math.Sin(radian) * a)
	return math.Sqrt(math.Pow(x, 2.0) + math.Pow(y, 2.0))
}

func abs(x float64) float64 {
	if x < 0.0 {
		return -x
	}
	return x
}
//  [ruby]
#!/usr/bin/env ruby
require 'matrix'

A,B,H,M = gets.chomp.split.map(&:to_i)
Hdeg = (30.0 * H - 0.5 * M) * Math::PI / 180.0
Mdeg =   5.0 * M * Math::PI / 180.0

Av = Vector[A * Math.cos(Hdeg), A * Math.sin(Hdeg)]
Bv = Vector[B * Math.cos(Mdeg), B * Math.sin(Mdeg)]

puts (Av - Bv).r
//  [ruby]
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
a,b,h,m = gets.chomp.split.map(&:to_i)
kaku = h.to_f / 12 + m.to_f / 60 / 12 - m.to_f / 60
puts Math.sqrt(a**2 + b**2 - 2.0*a*b*Math.cos(kaku * 360 * Math::PI / 180))
//  [ruby]
require 'bigdecimal'
require 'bigdecimal/util'
require "bigdecimal/math"
include BigMath

A, B, H, M = gets.chomp.split.map(&:to_d)

theta = BigMath::PI(12) * 2 * (H / 12.0 + ((M / 60.0) / 12.0) - (M / 60.0))

puts BigMath::sqrt(( A**2 + B**2 - (2 * A * B * BigMath::cos(theta,12)) ).abs, 12)
//  [swift]
import Foundation

func f(A: Int, B: Int, H: Int, M: Int) -> Double {
    // A: cm
    // B: cm
    // H: 時
    // M: 分
    let h: Double = ((Double(H) + (Double(M)/60)) / 12 * 360).truncatingRemainder(dividingBy: 360) * Double.pi / 180
    let m: Double = (( Double(H)*60 + Double(M)) / 60 * 360).truncatingRemainder(dividingBy: 360) * Double.pi / 180
    let c: Double = sqrt( ((pow(Decimal(A), 2) + pow(Decimal(B), 2)) as NSDecimalNumber).doubleValue - Double(2*A*B) * cos(  abs(h - m) ) )
    return c
}

let input = readLine()!.components(separatedBy: " ").map{ Int($0)! }
print( f(A: input[0], B: input[1], H: input[2], M: input[3]) )
//  [swift]
import Foundation

let input = readLine()!.components(separatedBy: " ").map({Double($0)!})

let A = input[0]
let B = input[1]
let H = input[2]
let M = input[3]

/*

何をする問題か
角度の差を求めて距離を出す

*/

//時針は1時間で何度動くか？
//30度
let HourAnglePerH = 360.0/12
//時針は1分で何度動くか？
//0.5度
let HourAnglePerM = 360.0/(12*60)
//時針の角度は？
let HourAngle = HourAnglePerH*H + HourAnglePerM*M

//分針は1分で何度動くか？
//6度
let MinuteAnglePerM = 360.0/60
//分針の角度は？
let MinuteAngle = MinuteAnglePerM*M

//分針と時針の角度の差は？
//差が180を超える時、360からそれを引く。
var angleDiff: CGFloat = CGFloat(abs(HourAngle-MinuteAngle))
if angleDiff > 180 {
    angleDiff = 360-angleDiff
}

//角度の差と針の長さから距離を求める
//a2 = b2+c2-2bc cosA

var cosValue:Double
cosValue = Double(cos(CGFloat.pi/180.0*angleDiff))
let temp:Double = Double((A*A))+Double((B*B))-(Double(2*A*B)*cosValue)

print(sqrt(temp))
//  [swift]
// : (Colon) 

import Foundation

func main() {
    let i = readLine()!.split(separator: " ").map{Double($0)!}
        
    let (a,b,h,m) = (i[0], i[1], i[2], i[3])
    let pi = Double.pi
    // それぞれの針の角度
    let x = 2 * pi * (h * 60 + m) / (60 * 12)
    let y = 2 * pi * (m) / (60)

    let (ax, ay) = (a * cos(x), a * sin(x))
    let (bx, by) = (b * cos(y), b * sin(y))
    
    let distance = pow(pow(ax - bx, 2) + pow(ay - by, 2), 0.5)
    print(distance)
}

main()
//  [typescript]
import { count } from 'console';

process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
let gInput = '';
process.stdin.on('data', (chunk) => (gInput += chunk));
process.stdin.on('end', () => main(gInput.split(/\r?\n/)));

// 解答
function main(inputs: string[]): void {
  const [a, b, h, m] = inputs[0].split(' ').map(Number);

  const hRad = ((60 * h + m) / (60 * 12)) * 2 * Math.PI;
  const mRad = (m / 60) * 2 * Math.PI;

  console.log(Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b * Math.cos(hRad - mRad)));
}
//  [typescript]
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  const rule = lines.shift().split(" ").map(Number);
  const long = rule[0];
  const short = rule[1];
  const h = rule[2];
  const m = rule[3];

  let angle = 30 * h + m * 0.5 - 6 * m;
  if (angle >= 180) angle = 360 - angle;

  let res =
    Math.pow(long, 2) +
    Math.pow(short, 2) -
    2 * long * short * Math.cos(angle * (Math.PI / 180));

  res = Math.sqrt(res);
  console.log( res);
});
//  [python]
s = raw_input()
print 'Yes' if (s[:-1] == s[0]*3) or (s[1:] == s[1] * 3)  else 'No'
//  [python]
import numpy as np

N = input()


def foo(s):
    n = int(s[0])
    return (np.array(list(map(int, s))) == n).all()


if foo(N[:3]) or foo(N[1:]):
    print("Yes")
else:
    print("No")
//  [python]
# -*- coding: utf-8 -*-
import numpy as np
a = int(input())
b = []

while a != 0:
    b.append(int(a % 10))
    a = int(a / 10)

if b[0] == b[1] and b[0] == b[2]:
    print("Yes")
elif b[3] == b[2] and b[3] == b[1]:
    print("Yes")
else:
    print("No")
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String input = br.readLine();
		char[] chars = input.toCharArray();
		
		if(chars[1] == chars[2] && (chars[0] == chars[1] || chars[2] == chars[3])){
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		
	}

}
//  [java]
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String n[] = sc.next().split("");
    if (n[0].equals(n[1]) && n[1].equals(n[2])){
      System.out.println("Yes");
    }else if (n[1].equals(n[2]) && n[2].equals(n[3])){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}
//  [java]
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ZYCSwing
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();

            if (s.charAt(0) == s.charAt(1) && s.charAt(1) == s.charAt(2)) {
                out.println("Yes");
            } else if (s.charAt(1) == s.charAt(2) && s.charAt(2) == s.charAt(3)) {
                out.println("Yes");
            } else {
                out.println("No");
            }
        }

    }
}